Lindsay Roy (second right) took Glenrothes with a reduced majority
The Labour victor of the Glenrothes by-election has taken up his seat in the House of Commons.
Lindsay Roy, the former head of Kirkcaldy High School, met the prime minister for breakfast before being cheered outside the Commons.
He was given a warm welcome in the House as he entered the chamber.
Mr Roy, who held the Glenrothes seat with a reduced Labour majority of 6,737, said his victory represented a real set-back for the SNP.
He also said he was ''exhilarated and humbled'' to have held the seat for Labour last week, against many predictions that the SNP would win.
Gordon Brown hailed Labour's victory as a vote of confidence in the government's handling of the economic crisis. He broke with tradition by joining the campaign on the ground in the seat, which neighbours his own.
Mr Roy, the 59-year-old head teacher of Mr Brown's former school, swore an oath to the Queen under the eyes of his party leader shortly after Prime Minister's Question Time.
A married father-of-three, Mr Roy is a church elder and a keen mountain biker and footballer who once played in a Scottish Cup tie.
He takes the place of John MacDougall, who died in August after being diagnosed with the asbestos-related cancer mesothelioma.
Mr Roy's Commons introduction comes just over a month after that of the SNP's John Mason, who snatched the Glasgow East seat from Labour in July.
That contest featured a 22.53% swing from Labour to the SNP, compared with only 4.96% at Glenrothes.