Gordon Brown's Waterloo turned out to be his Trafalgar. Only a few months ago, the Glenrothes by-election was being talked up as the defeat that would force the Prime Minister out of office. But instead Mr Brown has pulled off a famous victory and one that, his supporters argue, will turn the tide in the greater war for a fourth Labour term.
Well, up to a point. Holding Glenrothes this week certainly puts some strong wind into the Prime Minister's sails. It brings to an end the Government's miserable sequence of losing safe seats in by-elections. And it helps to erase the particular humiliation of Glasgow East in July, when Labour saw a 13,500 majority overturned. Glenrothes also gives the Labour Party genuine cause for hope in the longer term. By-elections are, by long-standing custom, occasions for voters of all affiliations to give the government of the day a kicking. For Labour to have not only held Glenrothes but also to have increased its share of the vote suggests the party is enjoying a genuine resurgence of support.
There are, however, some caveats. First: the particular circumstances in Glenrothes. Labour was able to present its main challenger, the SNP, as the effective party of government, because of the nationalists' control of the local council, and itself as the opposition. That tactic will not be available in the next general election, when Labour will be the long-standing incumbent.
Second: the Tories still enjoy a pretty healthy poll lead at a national level. The Brown "bounce" has some distance to travel if it is to put Labour in a position to win at the next election. And it remains anything but clear whether voters will continue to look kindly on the Government's performance when job losses mount and recession starts to bite.
Yet there can be no doubt that it is Labour's opponents who emerge from campaigning in Fife looking the worse for wear. The biggest casualty is the SNP. The local council's decision to raise charges for some home care services lost the SNP votes. With power comes accountability. The SNP's handling of the campaign was also misjudged. Labour did a good job of managing down expectations. The SNP, by contrast, seemed intent on managing up its own prospects of winning. SNP officials were forecasting victory right up until the count. The scale of the nationalists' eventual defeat makes that confidence look like hubris.
As for the Tories and the Liberal Democrats, they were always destined to be bit-part players in this election. But they too have reasons to read the runes of Glenrothes with some trepidation. The Prime Minister's pitch to voters of Labour as the safest bet in these threatening economic times seems to have had some effect. This appeal was filtered through the prism of Scottish politics, in particular Alex Salmond's unfortunate citation of Iceland as a model for an independent Scotland. But there is no reason to presume that Mr Brown's argument will be dramatically less effective among voters in the rest of the UK.
That presents a major challenge to the other national opposition parties. What Glenrothes emphasises is the need for the Liberal Democrats and the Conservatives to improve their game on the economy. The Tories, with their image as the party of deregulation and inherited privilege, have a particular problem here. It was never going to be enough for David Cameron to sit on his hands and wait for recession to deliver the next election into his lap. But after Glenrothes, it is clear just how much work the Conservative leader has to do.