The Conservatives defied expectations and exit polls to hold Moray – only their second win in the seat since 1983.
Predictions gave candidate Douglas Ross only a 1% chance of returning as MP amid a national swing to the SNP.
Following the result, Mr Ross confessed he thought he was “a goner” on a night his Scottish party members were swept aside.
The results place the north-east MP in a leading position to claim a position in Boris Johnson’s next cabinet – a prospect he quickly dismissed despite Moray being the only Scottish seat the prime minister visited on the campaign trail.
Mr Ross said: “I have literally walked off stage to save one job I thought I had lost, I’m not even thinking about getting another one.”
The Conservative candidate was returned as Moray MP with 22,112 votes – a majority of just 513.
However, that margin was slashed from 4,159 in 2017 with SNP candidate Laura Mitchell coming a close second at the Elgin Town Hall count.
Mr Ross added: “Naturally I was elated when I saw the exit poll that said the Conservatives would get a majority nationally.
“When I saw the Scotland predictions I thought there was no chance, I thought I was a goner, so I’m very surprised to have held on.
“I’ve lost a lot of colleagues but that’s not a reflection on them personally. I hope to see many of them back again.”
Moray has been a heartland seat for the SNP since the 1970s and the party had high hopes of reclaiming the region amid sweeping wins across the country to replicate the days of thumping majorities with Angus Robertson.
Ms Mitchell believes the narrowing majority means it is only a matter of time before the party takes the seat back.
She said: “We always knew Moray would be on a knife-edge. We pushed the Tories all the way, it’s just a shame we fell a bit short.
“The momentum is absolutely with the SNP here though. We’ll be working flat-out to get this seat back.”