Election 2015: SNP and Conservatives take south Scotland seats
Conservative David Mundell has held onto his south of Scotland seat but Labour's Russell Brown has been ousted by the SNP's Richard Arkless.
A recount was required in Berwickshire, Roxburgh and Selkirk before it went to Calum Kerr of the SNP.
A 29% rise in the SNP vote saw Mr Arkless win Dumfries and Galloway with a majority of more than 6,500.
A similar surge in Dumfriesshire, Clydesdale and Tweeddale left the SNP about 800 votes short of Mr Mundell.
Mr Mundell saw his share of the vote rise slightly, which proved enough to narrowly hold off the SNP's Emma Harper.
'People wanted stability'
Speaking afterwards, he said: "I think it is quite clear in this constituency people did want an MP who represented their views in relation to the future of our United Kingdom and I do think the economy did play an important part as well.
"I think people wanted the stability that a Conservative or Conservative-led government would bring."
Labour's Archie Dryburgh was a distant third, with UKIP's Kevin Newton in fourth, ahead of Lib Dem Amanda Kubie and Green candidate Jody Jamieson.
Ms Harper said she was proud to have increased the SNP's share of the vote in the constituency from 10.5% five years ago.
"I think the people of Scotland want fairness, equality and justice and an end to austerity and the SNP is the only party with the agenda to help the most vulnerable people in society. That's why the people of Scotland have turned to the SNP this time," she added.
In neighbouring Dumfries and Galloway, Russell Brown joined the long list of deposed Labour MPs across Scotland as the SNP's Mr Arkless won the seat.
The new MP said: "We are very clear about the pledges we have put forward, that is we are going to do everything we can to back an end to austerity, get more powers for the Scottish Parliament and other progressive politics, that we think we could build alliances across the UK and bring some progressive change to the UK which we think it badly needs."
Conservative Finlay Carson finished in second place, ahead of Mr Brown in third.
The Labour candidate, who has been involved in nine election campaigns, said: "I have never seen a campaign like this before. It got more into the realms of a propaganda war out there on the streets.
"A lot of things we were putting forward as a party and I was putting forward as a candidate in a positive manner about redistribution of wealth and trying to do something about long-term unemployment and increasing the minimum wage and the living wage. All that was drowned out."
UKIP's Geoff Siddall was fourth with Lib Dem Andrew Metcalf behind him.
The result in Berwickshire, Roxburgh and Selkirk, the Borders constituency previously held by Lib Dem Michael Moore, was announced at about 07:30.
Calum Kerr of the SNP was triumphant ahead of Conservative John Lamont with Mr Moore in third place.
The former Secretary of State for Scotland paid tribute to Mr Kerr and his "fantastic" campaign.
He added: "For us as Liberals, we are going to have to reflect on what happened over night.
"Some of this was signalled year after year in the course of the coalition but we were there, we took difficult decisions. We now need to make sure we can refashion Liberalism in Scotland and across the UK to make ourselves relevant once again to the voters of the country."
Mr Kerr said he was "honoured" to be elected following a "fair, decent and civilised" campaign in the Borders.
Labour's Kenryck Lloyd-Jones finished fourth, followed by UKIP's Peter Neilson, Green Pauline Stewart and Independent Jesse Rae.