The Tories have acknowledged their fourth place in the Hartlepool by-election was "very disappointing".
Labour candidate Iain Wright was 2,033 votes ahead of the Lib Dems
Labour's Iain Wright won the contest, although his party's majority was slashed from more than 14,000 to just over 2,000.
The Liberal Democrats' candidate Jody Dunn came in second with 10,719 votes.
Conservative Jeremy Middleton came in fourth on 3,044 behind the UK Independence Party's Stephen Allison on 3,193.
The result comes as the Tories prepare to hold their annual conference next week.
Mr Wright said the result was "great news for Tony Blair, a huge disappointment for Charles Kennedy and an absolute disaster for Michael Howard".
Shadow Work and Pensions Secretary David Willetts conceded it was a disappointing result.
1-Iain Wright (Labour) 12,752
2-Jody Dunn (Lib Dem) 10,719
3-Stephen Allison (UKIP) 3,193
4-Jeremy Middleton (Conservative) 3,044
5-John Bloom (Respect) 572
6-Iris Ryder (Green) 255
7-James Starkey (NF) 246
8-Paul Watson (F4J) 139
9-Christopher Herriot (Socialist Labour) 95
10-Richard Rodgers (Common Good) 91
11-Philip Berriman (Ind) 90
12-Alan 'Howling Laud' Hope (Monster Raving Looney) 80
13-Ronnie Carroll (Ind) 45
14-Edward Abrams (English Democrats) 41
"There is no point pretending otherwise. It is a blow," he said.
But he rejected suggestions that his party's fortunes would be boosted by a change of leader.
"One of the things our party has learned by now is that endless speculation about the leadership is a self-indulgence that we simply cannot afford," he
"We are simply - the Conservative Party - not going down that road."
'Disastrous for Labour'
Lib Dem party president Simon Hughes said: "The Tories have not just been overtaken, they have been left in the lay-by and overtaken by UKIP.
"It is the only time the Tories have gone from second to fourth since the Tory Party was formed."
UKIP's Roger Knapman said his party could now approach the election, predicted for next year, with "some confidence".
Mr Knapman predicted that UKIP, which favours British withdrawal from the EU and won 12 seats in the European Parliament in June, would now win seats at Westminster.
The Tories concede the result is a blow for them
"We beat the Liberal Democrats in the European elections. We beat the Conservatives tonight. We are on our way."
UKIP candidate Stephen Allison said: "For the first time we have proved that we are going to be the third party in British politics."
His colleague in the European Parliament, Robert Kilroy Silk MEP, said people had turned to UKIP because it was a party that told the truth.
"People are fed up of the old parties, both of them, they are fed up of all the name-calling, they're fed up of the sloganising, the smearing."
"They want party with a fresh face and people who tell them the truth."
He also said he was confident UKIP would win seats at Westminster in the next General Election.
But Tory co-chairman Liam Fox focused on the fact that the Labour candidate Iain Wright had seen the party's majority slashed.
"This is a disastrous result for them. They have come close to losing one of their safest seats."
Commons Leader Peter Hain branded the result "an absolute catastrophe for the Conservative Party and for Michael Howard who has simply shown he is not taking them anywhere".
It is thought to be the first time the official opposition has come fourth in a by-election since 1974.
Labour's new MP won 12,752 votes in Thursday's by-election - 2,033 ahead of Jody Dunn of the Liberal Democrats, on 10,719.
At the 2001 General Election Mr Mandelson had a 14,571 majority for Labour.
Demonstrations by direct action pressure group Fathers 4 Justice, which also contested the seat, marred the count.
Fathers-4-Justice candidate Paul Watson was arrested after purple flour was thrown at Ms Dunn as she started to make her speech on the podium.
He was later released on police bail.
Turnout was just under 46%, down about 10% from 56% at the 2001 General Election but in line with many recent by-elections.