Labour pulled off a major coup to regain their former stronghold of Kirkcaldy and Cowdenbeath from the SNP.
Fife Council’s former deputy leader Lesley Laird overturned an almost 10,000 majority to push previous MP Roger Mullin into second place.
She paid tribute to ex Prime Minister Gordon Brown, who held the seat for 32 years, declaring: “Gordon Brown, this is for you!”
Mrs Laird said it was clear during her campaign that local people were returning to Labour in their droves.
“When this election was called, it’s fair to say nobody gave Labour a chance of winning this seat,” she said.
“This election has been about choices, a positive path or more years of negativity, grievance and austerity.
“I am delighted the people of Kirkcaldy and Cowdenbeath have voted for hope.”
She said people were fed up hearing about Brexit and a second indyref, adding: “They want to move on and address issues that really concern them.
“What we were seeing on the doorsteps was people were coming back to Labour and they wanted to talk to Labour.
“Our manifesto was exciting people.”
Mrs Laird has pledged to “work her socks off” during her term as MP.
“My work starts here and there is much to be done,” she said.
Mr Mullin said he was disappointed with the result but added: “I think in the morning I’ll still be able to look at myself in the mirror and know that for the last two years I have done all I could to serve the people of this constituency.
“Obviously they have felt that’s not siufficient on this occasion.
“I feel for my staff because they have helped not just me but thousands of people in the constituency.”
Tory candidate Dave Dempsey, who finished in third place, said: “We’re on the up.
“We’ve a wee bit to go yet but watch for us, we’re coming.”
Kirkcaldy and Cowdenbeath result:
Lesley Laird (Lab) – 17,016
Roger Mullin (SNP) – 16,757
Dave Dempsey (Con) – 10,762
Malcolm Wood (Lib Dem) – 1,118
David Coburn (UKIP) – 540
Labour majority – 259