Tory Louie French is the UK’s newest MP after winning the Old Bexley and Sidcup by-election.
Mr French took more than half the votes in the contest, which was triggered by the death of former Cabinet minister James Brokenshire.
But there was a 10% swing to Labour and two-thirds of eligible voters chose to stay at home, meaning the Tory majority was slashed from almost 19,000 to 4,478.
Mr French used his acceptance speech to pay tribute to his “good friend” Mr Brokenshire, who died from lung cancer in October.
He said: “This has been a tough contest, which has been fought with dignity and respect.”
The by-election took place against a difficult backdrop for the Tories after weeks of allegations about sleaze, Boris Johnson’s chaotic speech to the Confederation of British Industry, claims that lockdown rules were broken in No 10 last Christmas and the imposition of coronavirus restrictions following the emergence of the Omicron stage.
But Mr French insisted it was local issues which dominated the campaign.
“My focus will now be delivering on those promises that I made during the campaign – get our fair share of London’s police officers, securing more investment for local schools and hospitals, protecting our precious green spaces.”
He promised voters he would “work tirelessly to repay the trust that you’ve placed in me and I will not let you down”.
Mr French, a local councillor, said: “This is the greatest honour of my life. And I hope it inspires people to achieve their own dreams.”
Turnout in the contest was just 34%, down from the almost 70% who voted in the 2019 general election.
Labour’s Daniel Francis secured 6,711 votes, almost 31% of the total, up from the 23.5% the party received in 2019.
The Tory vote share decreased – Mr Brokenshire had 64.5% in 2019, Mr French had 51.5% – and Labour pointed to a 10% swing in their favour.
A tilt of that margin in the Prime Minister’s Uxbridge and South Ruislip would be enough to oust him, Labour sources said.
Shadow solicitor general Ellie Reeves told the PA news agency: “We’re pleased with the result tonight.
“This is a Conservative stronghold, somewhere that had a 19,000 majority at the last general election and what we’ve seen tonight is that majority being slashed. There’s been a 10% swing over to Labour this evening.
“We’ve been knocking on doors for weeks here and finding many, many Conservative voters that have said actually I’m not going to vote for them this time, I’m going to vote for Labour.
“I think it’s clear that we’re winning back the trust of people and it’s a remarkable result for us in a Tory stronghold.”
She added that the swing showed that “even for Tory heartland voters Boris Johnson’s jokes aren’t funny any more”.
But Tory deputy chairman Justin Tomlinson told the PA news agency: “We’re absolutely thrilled. For a Government to get over 50% of the vote in a parliamentary by-election is almost unheard of, and with a majority of over 20%.”
He added that the result was an “absolute disaster” for the Labour Party, saying: “They do not look like a government in waiting.”