Scottish Liberal Democrat leader Willie Rennie has taken the Fife North East seat from the SNP.
The politician, who had secured his 2011 seat through the list vote, beat SNP candidate rival Roderick Campbell by 3,465 votes.
Mr Rennie received 14,928 votes, an increase of 15% from 2011.
He said: "It feels fantastic to have won North East Fife back for the Liberal Democrats. A big majority of 3,000 against a Nationalist tide."
Mr Rennie added: "It's a tremendous result for the Liberal Democrats in North East Fife."
In his victory speech, he said it had been a "positive, uplifting campaign" and added: "I've had the time of my life in this campaign."
He appeared at the count with two toy pigs in his hand, a reference to a photo opportunity at farm while out on the campaign trail.
Alex Cole-Hamilton, of the Liberal Democrats, also won Edinburgh Western from the SNP, with 16,645 votes - a 42% share.
The party also comfortably held both Orkney and Shetland.