The SNP’s former leader Alex Salmond has lost his Gordon seat to the Scottish Conservatives.
The Tories also defeated the SNP’s deputy leader Angus Robertson as they surged across Scotland.
The SNP are currently on 34 seats – a majority of the 59 Scottish constituencies but a drop of 22 from the 56 they won in 2015.
The Conservatives have won 12 seats in Scotland so far, with Labour winning seven and the Liberal Democrats four.
The three pro-UK parties had won just one seat each the last time around.
The Tories have seen big increases in their vote across the country, with the SNP vote dropping sharply.
With just three Scottish seats still to declare – including Fife North East, where a third recount is under way – the SNP had won 37.2% of the votes, a drop of 13 percentage points since 2015.
The Scottish Tories had doubled their share of the vote to 28%, with Labour on 27.7% and the Lib Dems on 6.5%.
But the picture is less positive for the Conservatives across the UK, with the party expected to lose its majority at Westminster and the prime minister facing calls for her resignation.
‘Grievous blow’
Mr Salmond, who was Scotland’s first minister between 2007 and 2014, had won a majority of 8,687 at the last election in 2015.
But the Conservatives saw their share of the vote increase by 29% in the constituency as Colin Clark defeated the former first minister by 2,607 votes.
Despite his defeat, Mr Salmond insisted that people have “not seen the last of my bonnets and me”.
He added: “The SNP have lost many fine parliamentarians this evening and that’s a grievous blow to the SNP.
“But overall the result in Scotland shows the SNP will have won a majority of the seats in this country and the majority of the vote, something which I suspect the prime minister would like to be able to claim in the early hours of this morning but is not able to do so.”
Earlier, Douglas Ross of the Tories overturned a majority of 9,065 to defeat Mr Robertson – who had been the SNP’s leader at Westminster – by 4,200 votes in Moray.
The SNP’s Tasmina Ahmed-Sheikh has also lost Ochil and South Perthshire to the Tories, who were a distant third in 2015.
John Nicolson of the SNP lost Dunbartonshire East to Jo Swinson of the Liberal Democrats, who also saw Alistair Carmichael hold his Orkney and Shetland seat.
The results mean that the SNP has lost its Westminster leader, chief whip, foreign affairs spokesman and international trade spokeswoman.
Speaking as she arrived at the Glasgow count, First Minister Nicola Sturgeon said that the SNP had won the election in Scotland, with the party achieving its second best performance ever in a Westminster election.
Asked about the impact of the lost SNP seats on her desire to hold a second independence referendum, Ms Sturgeon said: “Like most politicians I have not had any sleep and I am not going to take any rash decisions.
“Clearly I have to reflect on the result of the election and I will take time to do that. But it would be the wrong thing for me to do at this hour to take decisions before having had the opportunity to properly think about it.
“But properly think about it I will certainly do”.
Scottish Conservative leader Ruth Davidson hailed a “historic” night for her party, which she said was largely due to Ms Sturgeon’s attempts to “ram-raid through” a second independence referendum.
She added: “I think we have seen the country’s reaction in the number of SNP seat’s falling. Indyref2 is dead.”
“Now it’s time to get back to what matters to the people of Scotland – that’s sorting out our schools, growing our economy and looking at our public services.”
And Labour’s Ian Murray, who increased his majority in Edinburgh to more than 15,000, said voters had “hammered the final nail into the independence coffin”.
There was better news for the SNP in Paisley and Renfrewshire South, where Mhairi Black kept her seat despite a big drop in her share of the vote.
Ms Black, the youngest MP at Westminster in the last parliament, had her majority over Labour cut from about 6,000 to about 2,500.
Elsewhere, Stewart Hosie held Dundee East – which had been the safest seat in Scotland – for the SNP, while Angus MacNeil held on in the Western Isles, despite his share of the vote falling by nearly 14%.
Pete Wishart also held on for the SNP in Perth and Perthshire North after finishing just 21 votes ahead of the Tory candidate, while Tommy Sheppard held Edinburgh East.
An exit poll had predicted that the SNP would lose 22 of the 56 seats it won in the last election in 2015.
The poll, which was taken at polling stations across the UK, also suggested the Conservatives would fall short of an overall majority at Westminster.
SNP politicians had cast doubt on the exit poll result when it was first published – with many insisting the party would not lose as many as 22 seats.
Join GhanaStar.com to receive daily email alerts of breaking news in Ghana. GhanaStar.com is your source for all Ghana News. Get the latest Ghana news, breaking news, sports, politics, entertainment and more about Ghana, Africa and beyond.