When voters go to the polls tomorrow they are almost certain to elect Labour Euro-MP Catherine Stihler as their new representative at Westminster.
But even the most confident politicians experience a frisson of uncertainty when it comes to by-elections - and the safer the seat ought to be, the bigger potential there is for a major upset.
That's why Mr Brown has appeared uncharacteristically nervous over the past few weeks. Boundary changes at last year's general election may mean he is no longer the MP for places like Rosyth and Inverkeithing, but this is still seen as his patch and a poor performance by Labour could be damaging for the Prime Minister in waiting.
The Liberal Democrats, who were second last time, claim they are "closing" on Labour and the Scottish Nationalists, who were a close third, say they have overtaken the Lib Dems and could be within just three per cent of Labour.
One senior Labour figure says his party should win, but adds: "It's a by-election and if turnout is low, anything could happen."
The announcement of 700 job losses in the constituency with the closure of the Lexmark factory added a sombre note to the campaign. At one time such news would have spelled serious trouble for the party in power, but nowadays it is taken as the inevitable risk associated with investment by international firms.
The Forth Road Bridge has been the issue to capture most attention, mainly thanks to Mr Brown's intervention over the proposed 4 toll and the need for a second crossing. But possibly an even bigger area of concern for voters is the plan to downgrade Dunfermline's Queen Margaret Hospital.
It was hard not to feel sorry for the people of Dunfermline as they tried to do their shopping last Saturday morning. They had already endured a veritable media circus two days earlier when the Chancellor, Tory leader David Cameron, SNP leader Alex Salmond and former Lib Dem leader Charles Kennedy all made high-profile visits to the town.
And here they were, besieged once more by groups of politicians of all dispositions pouncing upon them within yards of each other.
Deputy First Minister and Scottish Lib Dem leader Nicol Stephen was there to accompany his party's candidate Willie Rennie on a sweep of the High Street, followed in close formation by a phalanx of Lib Dem activists, holding aloft diamond-shaped placards.
FIRST Minister Jack McConnell had put in an appearance earlier to boost Labour's campaign. Now a group of Labour MSPs and activists darted here and there handing out leaflets and red balloons to unsuspecting passers-by.
Mr Salmond was back, along with deputy Nicola Sturgeon, chatting one-to-one with locals, while Tory candidate Carrie Ruxton was rushed from shopper to shopper flanked by sole Scottish Tory MP David Mundell and officials. Former Labour MSP John McAllion, standing for the Scottish Socialists, was greeting people as they passed, while SSP leader Colin Fox attempted to grab their attention with the help of a megaphone.
The constituency, redrawn at last year's general election, includes not only Dunfermline but also Kincardine, Culross, Saline, Rosyth, North Queensferry, Inverkeithing and Crossgates.
Rachel Squire, whose death from a brain tumour led to the by-election, had been MP for the area since the 1992 general election.
The Lib Dems have mounted what they say is their biggest by-election operation in Scotland since Nicol Stephen won Kincardine and Deeside in 1991. They insist the bad publicity surrounding the party's leadership has not affected their reception on the doorstep. But it is hard to believe the ousting of a leader with a drink problem, followed by a rent-boy scandal involving one would-be successor and gay confessions from another will not dent their chances.
The party needs a 14 per cent swing to win the seat - which candidate Willie Rennie claims is far from impossible, recalling his role as agent in the Christchurch by-election in 1993, when the Lib Dems won the seat from the Tories with a 35 per cent swing.
Before last year's general election, the Scottish Nationalists were the habitual runners-up to Labour and they believe they have overtaken the Lib Dems once again. SNP candidate Douglas Chapman, who fought the seat last time, used to be a Rosyth councillor and also stood for the Scottish Parliament in Dunfermline West.
The Tories do not pretend they have any chance of winning the seat, but it is the first electoral test for David Cameron's new-image Conservatism. His candidate, dietician Carrie Ruxton, is eager to preach the message. "What I'm trying to do is get people talking about the Conservatives and having a different view of the Conservatives," she says.
She stood in Dunfermline East in the first Scottish Parliament elections but ruffled a few feathers down south when she was chosen to fight Northavon in Gloucestershire at the 2001 general election because she was an unmarried mother.
Now back living in Fife, she is seen as a rising star by the party leadership, but her selection was attacked by Tory councillor Stuart Randall, who had hoped to be the candidate. There was also controversy over Labour's selection of Ms Stihler since Euro MPs need special permission from the party's executive before they can bid for a seat at Westminster or Holyrood and others, including Lothians-based Euro MP David Martin have found their ambitions blocked.
However, politicians on all sides admit such internal squabbles are unlikely to have much effect on tomorrow's result.
In the end, the verdict of the voters will depend on a strange mixture of national and local concerns - whether they think any of the candidates can help save their hospital, how worried they are about bridge tolls, what they think of the Labour Government and whether they like the idea of Gordon Brown as Prime Minister.
But one political opponent claims despite his high profile and long connection with the area, the Chancellor has one major disadvantage in Dunfermline which has not yet been factored into the calculations - "He's a Raith Rovers supporter."
DUNFERMLINE AND WEST FIFE
Ian Borland UKIP Scotland
Douglas Chapman Scottish National Party
James Hargreaves Scottish Christian Party
John McAllion Scottish Socialist Party
Tom Minogue Abolish Forth Bridge Tolls Party
Willie Rennie Scottish Liberal Democrats
Dick Rodgers The Common Good
Carrie Ruxton Scottish Conservative and Unionist Party
Catherine Stihler Scottish Labour Party
2005 general election results
Rachel Squire Labour 20,111
David Herbert Lib Dem 8549
Douglas Chapman SNP 8026
Roger Smillie Conservative 4376
Susan Archibald SSP 689
Ian Borland UKIP 643
Labour majority 11,562