But while Premier Christy Clark bucked expectations around the province, she failed to win a seat for herself in the legislature. The NDP's David Eby defeated the premier in Vancouver-Point Grey by 785 votes, leaving Clark with the awkward task of finding a riding — presumably held by a Liberal who was just elected — where she can try again.
Story continues under gallery.
"Well, that was easy," a beaming Clark joked with supporters at the Liberal victory party in downtown Vancouver.
"Tonight, we have received a mandate from the people of British Columbia, and I say to the citizens of British Columbia: you have humbled us tonight with this opportunity and the tremendous obligation you placed on our shoulders. We will honour what you have bestowed on us, and together we will make British Columbia better."
The party increased its standings in the legislature, winning in at least 50 ridings. The Liberals had 45 seats before the legislature was dissolved.
The Liberal upset was the second recent Western Canadian election to stump the pollsters. Alberta's governing Conservatives pulled off a similar comeback in April 2012, when all predictions called for their defeat.
In both cases, it appears the electorate chose an unpopular but safe and middle-of-the-road choice over a more radical opposition — the right wing Wildrose Party in Alberta and the left-wing New Democrats in B.C.
The debate in B.C. will begin now: did Clark pull off a miracle win, or did Dix lose an election that was his for the taking?
More Election 2013 Coverage:Dix addressed party members in Vancouver, conceding defeat but offering no explanation for why his party fell so far below expectations. Nor did he make any mention of his own future as leader.
"We have elected a very strong team that's going to hold the government accountable," Dix said.
"This party's determination to bring change will continue. We've brought change because we connect with people. We brought change because we fight for a better society — and we are going to continue to do just that."
At NDP headquarters, exhausted campaign workers who had been floating through Dix's stump speeches for a month buoyed by certainty of a win, collapsed in tears.
The Liberals jumped into the lead in early returns and never fell behind the New Democrats. Their victories included both Kamloops-area ridings that have been considered bellwethers in provincial elections for a century.
Even Liberals seemed stunned by the magnitude of the turnaround. Early in the evening, a small crowd at Liberal headquarters erupted in sporadic shouts as results came in their favour.
The crowd quickly grew and turned more boisterous as it became clear the downtown party headquarters would be hosting a victory celebration rather than a wake for the party's demise.
Longtime Liberals were privately as shocked as pundits — and likely, so too were pollsters. But publicly, those close to the campaign said they knew it all along.
"There were some signals that such a result was possible over the last year and a half," Barry Penner, a longtime Liberal and former cabinet minister who left politics in 2011, said in an interview.
"At no time did support for the NDP register greater than 50 per cent in major public opinion polls. Even at the lowest ebb for the B.C. Liberal party, the public was not wildly enthusiastic for Adrian Dix or the NDP. That was a signal that the public was not falling in love with the NDP."
In Clark's own riding, previously held by former Liberal premier Gordon Campbell, Eby defeated the premier in a race that was too close to call until well past midnight. It was the second race against Clark for newly elected NDP candidate David Eby, a prominent civil liberties lawyer who also challenged her in a byelection in 2011.
Neither Clark nor party officials were available to comment about the loss.
"I don't know what's going to happen in my riding — let's wait and see when all the polls come in," Clark told reporters.
"There was a pretty significant advanced poll in that riding, so really, I don't know what the results are going to be."
Opinion polls had consistently placed Clark's main opponent, Dix, as a favourite to win. Dix ran a populist campaign that urged voters it was time for a change after 12 years of Liberal governments.
Former NDP finance minister Paul Ramsey, who was spending the night at the party's headquarters, was at a loss to explain what happened.
"I'm with many people who worked on individual MLA campaigns, and what they're seeing on the television screens does not match what they're seeing and thinking about the polls, or what they were feeling on the doorsteps of the ridings," said Ramsey.
"I sense a real shock in the room, and I share that."
The election also brought in Canada's first Green to be elected to a provincial legislature. Climate scientist and Green party candidate Andrew Weaver defeated Liberal cabinet minister Ida Chong in Oak Bay-Gordon Head, near Victoria.
The Liberals took back both seats in the Fraser Valley that the party lost in last year's byelections, and snatched a seat from longtime New Democrat Harry Lali in Fraser-Nicola, in the Fraser Canyon.
The vote came after a month-long campaign that saw the Liberals play the part of underdog under Clark, who took over the party from Gordon Campbell more than two years ago.
The Liberals were derided by much of the province over their introduction of the harmonized sales tax and other scandals, including the criminal probe into the sale of BC Rail.
During the campaign, Clark attempted to frame the election as a vote on the economy, gambling that her predecessor's economic record would be enough to convince voters to keep the Liberals in power.
She made bold promises to turn B.C. into a world leader in liquefied natural gas, confidentially predicting the industry will create tens of thousands of jobs and fuel government revenues that will one day make her province debt-free.
The Liberals attempted to cast the NDP as a party of anti-development radicals who would kill jobs and force workers to flea to Alberta — an image that was bolstered by Dix's mid-campaign announcement that he would oppose a pipeline expansion proposed by Kinder Morgan. In the dying days of the campaign, one of Clark's top cabinet ministers, Mike de Jong, invoked the likes of Fidel Castro and Hugo Chavez as he warned of the dangers of an NDP government.
Dix, in turn, claimed to take the high road, insisting his campaign was about ideas and not attacks. Still, his party spent the past month highlighting past Liberal scandals and accusing Clark of running a "fact-free campaign."
Minutes before Dix conceded, New Democrat Spencer Chandra Herbert, who was re-elected in Vancouver-West End, was taking the results in stride.
"I've always known that whether you're in government or sitting in opposition, you have an incredible role to fulfil and that is fighting for change," he said at the NDP headquarters.
"Whatever role the voters decide for us tonight, we're going to have to pick up that mantle and go for it."
Dix handily won his riding in Vancouver-Kingsway.
Conservative Leader John Cummins, whose party was considered a major threat to the Liberals just a year ago, was soundly defeated in Langley, where Liberal cabinet minister Mary Polak held onto the seat.
Green Leader Jane Sterk lost her riding of Victoria-Beacon Hill to former NDP leader Carole James.
There were other surprises that emerged throughout the night.
The NDP won Vancouver-Fairview with former union leader George Heyman as the candidate. He took the riding from Health Minister Margaret MacDiarmid.
John Van Dongen, a former Liberal who switched to the Conservatives and then became an Independent, lost in Abbotsford-South. The riding returned to the Liberals, with candidate Darryl Plecas, a criminology professor, projected to win by a large margin.
In Chilliwack, Liberal John Martin defeated New Democrat Patti MacAhonic. Martin had run as a Conservative in last year's Chilliwack-Hope byelection but later switched to the Liberals.
Vicki Huntington, a popular former Delta city councillor, was elected again in her riding of Delta-South as an Independent.