Pete Wishart of the SNP has secured a return to Westminster, but won the Perth and North Perthshire seat by just 21 votes.
On a night of high drama, there were two recounts before the veteran politician win was confirmed.
His 9,641 majority was devastated, however, in a seat which Conservative Ian Duncan had hoped to pinch.
Mr Wishart retains his status as Scotland’s longest-serving MSP by the narrowest of margins. He got 21,804 votes, down 8.2% on 2015, while Mr Duncan got 21,783.