Here's how the voters' verdict from Dunfermline will be regarded by the separate parties:

Labour

It was a terrific night for Labour who had seemed unaccountably nervous in the final days of the campaign.

Two years ago the Liberal Democrat collapse and the way the SNP roared through from third place left the party shell-shocked.

But this time they really just needed to play it safe, keep calm in the face of a tough onslaught from their SNP opponent, and protect their relatively inexperienced candidate.

They could then rely on the near certainty of some degree of swing against a mid-term Government to do their work form them.

Just 1% would have done it but they achieved 9% in the Nationalist bastion of Aberdeen Donside, so they were likely to do around as well in Dunfermline.

As the boxes came in from the old mining villages of West Fife it was clear that the Labour vote had turned out.

It was a sweet family revenge for Cara Hilton. Two years ago the SNP landslide claimed the constituency of her mother, Cathy Peattie, in Falkirk East.

However, Labour should avoid reading too much into this result as there were too many sub-texts to this battle: the Walker factor, the loss of the element of surprise from the Liberal Democrat collapse, the solidly Labour hinterland, and a Government in mid-term.

It was a good night, but they shouldn't get carried away. The first Holyrood by-election in 13 years to change hands is encouraging, but with all the backdrop to this campaign the swing of 7% was poorer than that achieved in Aberdeen Donside.

SNP

This was a perfect storm for the SNP, a very different by-election in every possible way to the one they held successfully in Aberdeen just four months ago.

In Donside the late Brian Adam had built a fiefdom, increasing his share of the vote at successive elections and building a formidable machine, and having an anointed successor who had a cushion to protect him from a nine-point swing.

Here, even if Bill Walker had been a saint struck down in his prime, he'd had no time to build on his incumbency. As it was, the unseemly way he clung to office in spite of his disgrace was a poisoned legacy for Shirley-Anne Somerville.

Did Dunfermline folk really resent that she was from rival town Kirkcaldy? Or bother that she did not live in the constituency but in North Queensferry, a mile outside it?

She was a spirited, experienced, tough candidate who seized on the school closures issue and worried away at it.

The campaign also focused on what they relentlessly referred to as Johann Lamont's "cuts commission" and its threats to the "People's Priorities" of personal care and free travel for the elderly, no tuition fees and even the end of bridge tolls.

It rattled Labour but it was never going to be enough.

Liberal Democrats

Anyone seeking signs of a LibDem recovery should look away now. Far from winning back lost ground the fortunes of the party have continued to deteriorate in a seat they held in the recent past at both Westminster and Holyrood, where their share has slid to a third of its 33% level achieved when Jim Tolson won it from Labour in 2007.

In a two-horse race the also-rans struggle to achieve any profile and that is what happened to Susan Leslie. The only saving grace was that they were still comfortably third but if this slide continues that won't last.

On the back of their coalition with the Tories, the next General Election will be a brutal test for the party.

Conservatives

Many feared the worst for the Tories and their affable young candidate James Reekie. In 2011 only the four main parties stood and he achieved just 7.1% of the vote.

With UKIP joining the fray there was thought to be a strong chance that the Tories would struggle to save their deposit.

They claim to know of several hundred of their voters who voted Labour to snub Alex Salmond and they lost some votes to UKIP, and yet they still put 1.2% on their vote. Not a bad night for them.

UKIP

WITH 908 votes, UKIP came up some 300 votes short of the 5% share which would have saved their deposit. They have now lost it at both the recent Holyrood by-elections, indicating that their hoped-for breakthrough north of the Border continues to elude them.

Scottish Green Party

The problem for the Greens is that they entirely lack grassroots activists and a party machine across large tracts of the country, something the leadership acknowledges.

Even with Edinburgh just 20 minutes away the lack of troops on the ground in Dunfermline meant that an acknowledged good candidate in Zara Kitson could muster just 593 votes

Independent

John Black, erstwhile of the Scottish Jacobites, wants to give the north of England a chance to join an independent Scotland.

Perhaps he would gather more votes down there than the 161 he got in the former Scots capital. He simply cuts an eccentric and pointless character, not even turning up for the count.