Party supporters faced an anxious wait through the night for final results from counts in the Orkney and Shetland and Argyll and Bute seats.
The final result, for Argyll and Bute, came through at about 1250 BST on Friday as Alan Reid successfully succeeded Ray Michie, albeit with a massively reduced majority.
And about 1120 BST the result for Orkney and Shetland came through with confirmation that Alistair Carmichael had held onto it for the party.
Mr Carmichael polled 6,919 votes to succeed Scottish Lib Dem leader Jim Wallace as the constituency MP.
His vote was 10.64% down on 1997 as there was a 6.48% swing to Labour. The turnout was about 12% down on the last general election.
The count in Orkney and Shetland was suspended until 0900 BST after an plane chartered to bring in ballot boxes was diverted to take a pregnant woman to hospital in Aberdeen.
By 0400 BST the Lib Dems had retained eight of its seats from 1997 and overtaken the Tories in terms of share of the vote.
The results show the party has established itself as the third force in Scottish politics, pushing the Tories into fourth for the first time.
The party secured 16.1% of the vote north of the Border, up 3.8% on 1997.
Leader Charles Kennedy - who secured victory in his Ross, Skye and Inverness West seat - described the Lib Dems as "the party of the future".
He said: "General elections are always a verdict on the government of the day but they are also a verdict on the opposition of the day.
"The gains that Liberal Democrats are making across the country...I think that this has been a very telling verdict on a UK basis on the future of British politics and what constitutes relevant and responsible opposition into the next parliament.
"This party will certainly seek to provide that."
Mr Kennedy more than trebled his previous majority by winning his seat with 18,832 votes.
The others returning to Westminster include foreign affairs spokesman Menzies Campbell, party president Malcolm Bruce, veteran MP Archy Kirkwood and transport spokesman Michael Moore.