The Liberals held on to Vaughan, the riding just north of Toronto vacated by former finance minister Greg Sorbara, with Steven Del Duca taking 51 per cent of the popular vote to easily defeat Progressive Conservative Tony Genco. The NDP was a distant third.
However, in Kitchener-Waterloo, New Democrat Catherine Fife, supported by teachers and other public sector workers angry at the Liberals for imposing a two-year wage freeze, won the large, urban riding for the first time in the party's history.
McGuinty didn't even mention the Kitchener-Waterloo loss when he appeared at Del Duca's headquarters to put the best face on the night's results, but acknowledged the unpopularity his government has faced as it tries to freeze public sector wages to eliminate a $15-billion deficit.
"You know, winning a byelection in government is never an easy thing at the best of times, and these are not the easiest of times," McGuinty told cheering Liberal supporters in Vaughan.
"It’s a more challenging time. We’re called upon to find a way to both eliminate the deficit and balance the budget in a way that doesn’t compromise the quality of our health care and education."
Fife, a popular school trustee, captured over 40 per cent of the vote, compared with about 31 per cent for the Conservatives and 23 per cent for the Liberals.
NDP Leader Andrea Horwath said voters were not impressed with the government's move to recall the legislature for an emergency session in August to impose a contract on Ontario teachers, which she insisted was really aimed at boosting Liberal chances in the byelections.
"Voters sent a message that they won't fall for Dalton McGuinty's manufactured crisis,," Horwath said in a statement.
"Voters across Kitchener-Waterloo who have never voted NDP in the past cast their ballots for positive change."
McGuinty engineered the byelection by appointing veteran Progressive Conservative Elizabeth Witmer to a $188,000-a-year post as head of the Workplace Safety and Insurance Board, convincing her to give up the seat she'd held for 22 years.
Backed by support from teachers and public sector workers, Fife came from behind to take the riding about 170 kilometres southwest of Toronto.
PC Leader Tim Hudak had downplayed expectations, calling Kitchener-Waterloo more of an Elizabeth Witmer riding than a Tory riding, and with an NDP win preventing a Liberal majority, he won't face challenges to his leadership for failing to hold the seat.
Hudak did not appear publicly Thursday night, but issued a statement blaming unions for teaming up to help the New Democrats take Kitchener-Waterloo.
"Tonight’s result has shown that public sector unions from across Ontario were provided with the perfect opportunity to concentrate their resources and lash out against the wage freeze we’ve been consistently pushing," said Hudak.
"They bought Kitchener-Waterloo, and now we can expect the rest of Ontario taxpayers to pay for it as the NDP cut more budget deals to keep the Liberals in power."
Hudak also lashed out at the Liberals for luring Witmer away in an effort to get their majority, and called the byelection results "bad news" for McGuinty.
"He rolled the dice with an expensive appointment to trigger a by-election to try and gain his coveted majority," said Hudak. "He failed and taxpayers lost."
Even though he didn't mention the failure to get his majority, McGuinty said he would always respect the wishes of voters.
"We’ve been called upon by the good people of Ontario, and we will always respect their choice with grace and enthusiasm," he said.
"We will continue to work with the other two opposition parties. We’ll continue to find common ground."
The Tories and NDP had urged voters not to give the Liberals a majority, accusing McGuinty of picking a fight with teachers to distract from the scandal at the Ornge air ambulance service and the $190-million cost of shutting down a generating station days before last fall's election to save Liberal seats in the Mississauga area.
Library technician Joe Walsh, 53, said he voted for Fife, noting the teachers' unions weren't about to turn to the Conservatives, who want to get even tougher with the wage freeze than the Liberals.
"This is historically a very blue Tory riding, but Hudak's really got the teachers on his back now, and there's nowhere for McGuinty supporters to go except the NDP."
Dan Kaye, 26, an environmental services manager at a local hospital, said he voted for the Tories in the Oct. 6 election, but voted for Fife Thursday because of her fiscal credentials.
"(With) her proven track record as a school board trustee to balance the budget...we need a good money manager for this region, and I thought she'd be the best candidate," said Kaye.
Derek Crozier, 40, a financial adviser and long-standing Progressive Conservative supporter, voted for Tory candidate Tracey Weiler.
"It was really an anybody-but-Liberal kind of vote tonight," he said.
_ With files from Will Campbell in Kitchener-Waterloo.
Also on HuffPost