Boris Johnson has been left with a working majority of just one in the House of Commons after the Tories were defeated in the Brecon and Radnorshire by-election.
The Liberal Democrats won the mid-Wales constituency by a margin of 1,425, swinging the vote nearly 12% from the Tories.
The first major electoral test of Mr Johnson as Tory leader became his first defeat with the announcement of Jane Dodds’ victory in the early hours of Friday.
The Tory loss will add to the PM’s challenges to steer Brexit through Parliament and may increase the chances of a snap general election.
With the vote coming eight days after Mr Johnson was appointed, it is the quickest by-election defeat for any PM of the post-War period.
She added: “I will fight to keep our country in the European Union, and we now have in Parliament one more MP who will fight to make that happen.”
The Lib Dem leader said she had exchanged messages with the Green and Plaid leaderships and told the BBC: “I think there will be more co-operation in future elections.”
Welsh Lib Dem leader Ms Dodds said: “My very first act as your MP when I arrive in Westminster will be to find Mr Boris Johnson wherever he is hiding and tell him loud and clear: ‘Stop playing with the future of our communities and rule out a no-deal Brexit now.’”
Despite 19% of the electorate petitioning for his recall, the Tories selected Mr Davies to fight to reclaim the seat.
The Lib Dems secured 43% of the vote, the Tories 39% and the Brexit Party 10%.
The vote may also be seen as an early victory for the “Remain alliance” of anti-Brexit parties, with Plaid Cymru and the Greens agreeing not to field candidates in order not to split the pro-EU vote.
Some Conservative commentators blamed the Brexit Party for splitting the “pro-Brexit vote” – as together their vote share amounted to 49%.
Plaid Cymru’s Westminster leader Liz Saville Roberts said: “The victory of Remain cross-party co-operation and Jane Dodds in Brecon and Radnorshire last night will give those in Downing Street plotting a snap general election pause for thought, because it shows they cannot take the public for granted.”
Mr Davies won the seat from the Lib Dems in 2015 and secured a majority of 8,038 in the 2017 general election.
The loss leaves the PM with the support of 319 MPs, including the DUP which props up his majority, while opposition parties now have 318.
Mr Davies’ recall came after he pleaded guilty in March to submitting two false expenses invoices for nine photographs costing £700 to decorate his new office.
He was fined £1,500, ordered to pay £2,500 towards legal costs and told to carry out 50 hours of community service.
In his losing speech, Mr Davies thanked his team and family “who have had a difficult time over the last few months”.