David Cameron was saved from a potentially humiliating Commons defeat on gay marriage by the Labour party last night, after a complicated series of political manoeuvres saw the prime minister face another damaging rebellion from his backbenchers.
But despite several Conservative rebel amendments, campaigners for gay marriage were celebrating after they passed another series of parliamentary hurdles.
Those efforts looked like they could have been sabotaged earlier, when Tory backbencher and campaigner against gay marriage Tim Loughton tabled an amendment demanding civil partnerships be made available to heterosexual couples.
The goal was to use it as a wrecking amendment, which would draw in Labour and Liberal Democrat support and delay the gay marriage bill for up to two years.
But the plan was foiled when shadow home secretary Yvette Cooper tabled a Labour amendment supporting the extension of civil partnerships as long as a consultation on the plans took place immediately rather than in five years.
Ministers backed that amendment, allowing Labour and Lib Dem MPs to express their opinion on civil partnerships for heterosexual couples without derailing the gay marriage bill.
The Loughton amendment was defeated by 375 to 70 after Labour told its MPs to vote it down.
Humiliatingly for Cameron, he was forced to rely on Labour support to get one of his own bills past his backbenchers.
It is just the most recent example of Miliband helping Cameron get past his party. Last week, Labour votes allowed the government's Queen's Speech to survive an attack from Tory backbenchers over the EU referendum.
But the result will have been particularly satisfying for the Labour leader, who can now claim convincingly to have saved the gay marriage bill from the hands of Tory backbenchers.
A spate of other Tory amendments designed to prevent or water down equal marriage were also defeated.
A Tory amendment calling for registrars to be allowed to conscientiously object to conducting same-sex weddings was defeated by 150 to 340.
Another amendment on allowing teachers with religious views to opt out of teaching gay marriage was withdrawn at the last minute.
An amendment which would protect the belief that marriage is between "a man and a woman" in the Equalities Act was defeated by 148 to 339.
As a free vote, the Tory efforts to derail the bill were not technically a rebellion, but the unmistakeable message of the day's events was that the parliamentary party is more concerned with damaging its own leadership than it is in taking on Labour.
The votes came as tensions between the Conservative party's rank-and-file and its leadership reach breaking point, following allegations that a senior Cameron ally branded local associations full of "swivel-eyed loons".
"There is a feeling that a group of people feel that they have taken over the party," Tory MP and party board member Brian Binley said.
Cameron was forced to write a letter to Tory members today stressing their "deep and lasting friendship", in a bid to build bridges following a damaging period in the party's history.
The Bow Group, a centre-right think tank, has complained of a "lack of Conservative vision and narrative in leadership and government".
Over 30 current and former chairs of Conservative associations have written to Cameron telling him to drop the gay marriage proposals, saying it was making it virtually impossible to win the election by alienating traditional Tory voters.
Nigel Farage made the most out of the row by taking out a full-page advert in today's Daily Telegraph telling Tory voters they are being treated with "contempt" by their own party and urging them to join Ukip.
The debate on the gay marriage bill continues tomorrow.