David Cameron and the Conservatives have been dealt an embarrassing blow in the final days of this Parliament after their plot to unseat House of Commons Speaker John Bercow was scuppered.

Tory grandee William Hague tabled a proposal to trigger a secret ballot if an MP shouts "object" when the Speaker begins to be re-installed after the general election in May. The free vote would have given MPs the chance to kick Bercow out of office.

But, due to Labour support and a minor backbench rebellion from some Tories, MPs voted 228 to 202 against the motion – a majority of only 26.

Bercow, who assumed office in 2009, has faced opposition from his own party during his administration.

The prime minister even told MPs after voting on Hague's proposal that he "wouldn't miss this for the world. Secret ballots [are] very important. Remember the Chartists".

But some of Cameron's own MPs were angered about the manoeuvre after only learning about the vote on 25 March.

Charles Walker, MPs for Broxbourne and chair of the Commons Procedure Committee, passionately claimed he had been "played as a fool" by Hague, the leader of the House, and Tory chief whip Michael Gove.

"How you treat people in this place is important. This week I went to the leader of the House's leaving drinks," he declared.

"I spent 20 minutes saying goodbye to his special adviser yesterday. I went into his private office and I was passed by the deputy leader of the House yesterday, all of whom would have been aware of what they were proposing to do."

He added: "I also had a number of friendly conversations chats with our chief whip yesterday. And yet I find out at 6.30pm last night that the leader of this House is bringing forward my report.

"I have been played as a fool. As I go home tonight, I will look in the mirror and I will see an honourable fool looking back at me. I would much rather be an honourable fool, in this or any other matter, than a clever man."

The speech was met with audible support from some backbench Tories and Labour MPs gave walker a standing ovation.

The defeat will leave Cameron and the Tories with a red face with just weeks to go before the general election.

The latest opinion poll from YouGov, which was conducted between 24 and 25 March, put Labour on a one-point lead over the Tories (35% vs 34%).

The study, which surveyed more than 1,600 voters, also put Ukip on 12%, the Liberal Democrats on 8% and the Greens on 6%.