Britain was braced for an election "cliffhanger", as the Tories were forecast to be the largest party at Westminster - but fall short of an overall majority.
A TV exit poll said the Conservatives would win 305 seats, Labour 255 and the Liberal Democrats 61.
Politicians of all parties were cautious about the survey, which would leave Conservative leader David Cameron 21 seats short of the total that would automatically hand him the keys to No 10.
Senior Labour figures, led by election supremo Lord Mandelson, made clear Gordon Brown would seek to stay in office with the help of the Lib Dems and other parties if the poll was reflected in real results.
The ratings in the BBC/ITV News/Sky News survey were a bitter blow for the Lib Dems, showing that an apparent surge of support after leader Nick Clegg was seen to have shone in Britain's first TV election debates had failed to translate into Commons seats. His party had 63 seats at the start of the campaign.
There was also chaos at polling stations across the country after hundreds of voters were unable to cast their ballots before the official 10pm closing time.
The Electoral Commission promised a "thorough review", amid warnings the problem could lead to results being challenged in the courts.
As the rollercoaster night of results began to unfold, Lord Mandelson made his party's position plain if there was a hung parliament.
The Business Secretary told BBC News: "The constitutional conventions are very clear.
"The rules are that if it's a hung parliament, it's not the party with the largest number of seats that has first go - it's the sitting government."
Pressed on whether Labour would seek to do a deal with the Lib Dems to try to hold on to power, he said: "I have no problem in principle in trying to supply this country with a strong and stable government."
He added that it looked as if the country was heading for a "cliffhanger of a result".
Home Secretary Alan Johnson, asked on BBC News if he had any problem in forming a pact with the Liberal Democrats, said: "I have no problem at all.
"If the will of the people is that no party has an overall majority, that's where grown-up, mature politicians have to be.
"I can't see the Lib Dems forming a deal with the Conservatives. I certainly can't see us forming a deal with Conservatives."
Lib Dem deputy leader Vince Cable described the outcome of the exit poll as "very strange" and insisted such polls had been "horribly wrong" in the past.
Shadow chancellor George Osborne said Labour could not continue in power if the exit poll was right.
He told BBC News: "It's pretty clear Labour cannot continue in government. They have been rejected by the British people and Britain needs a change in government.
"I don't think there's any question at all of Labour being able to continue in office."
The first real result came at just after 10.50pm, in the Houghton and Sunderland South constituency, which Labour held easily with a 10,990 majority.
Two neighbouring constituencies of Sunderland Central and Washington and Sunderland West also stayed in Labour hands, as expected.
As reports began to filter through of queues of frustrated voters trying in vain to cast their ballot before 10pm, Lord Mandelson acknowledged on BBC News that the situation could lead to legal challenges.
"What the returning officers should have done is brought everyone in and locked the door."
Tory party chairman Eric Pickles said: "It's ridiculous. Of course people should be able to vote.
"Surely to goodness, the returning officers could have just put the people in the polling station and continued."
The Electoral Commission said in a statement: "It is a cause for serious concern that many people who wanted to vote today were unable to do so by 10pm when polls closed.
"The Electoral Commission will be undertaking a thorough review of what has happened in those constituencies where people have been unable to vote."
The last "rogue" exit polls failed to predict John Major's Tory victory 18 years ago.
Two exit polls in the 1992 general election both predicted a hung parliament. In the event, the Tories secured an overall majority of 21 seats.
The polls variously showed that the Conservatives were 10 or 25 seats short of an overall majority and that Labour were 13 seats short.