Conservative MPs rounded on David Cameron and demanded a dramatic change of direction in his leadership following the party's Eastleigh by-election disaster – amid fears about the growing threat posed by the UK Independence Party.

A senior Tory who spent the last three weeks in Eastleigh told The Independent that Ukip had attracted support from traditional "blue-collar Tories" – and warned that the party urgently needed to revive its appeal to a key group of voters.

In the most fiercely fought contest since the general election, the Liberal Democrats shrugged off the furore over Lord Rennard to hold on to the Hampshire constituency, while Ukip pushed the Tories into third place and Labour limped in fourth.

Download the new Independent Premium app Sharing the full story, not just the headlines

The Tory defeat raised a new question mark over its ability to reach out to voters in the marginal seats it needs to capture in order to win a majority in the next election.

Mr Cameron and senior ministers insisted they had suffered from a mid-term "protest vote" that had boosted Ukip support but would melt away when the country went to the polls in 2015. They firmly dismissed suggestions that the Prime Minister would alter direction. But Michael Fabricant, the Tory vice-chairman in charge of parliamentary campaigning, said Ukip had evolved and no longer only appealed to people hostile to the European Union.

He said: "It also speaks to voters concerned about issues such as law and order, immigration, benefits and so forth.

"This has traditionally been the Conservative blue-collar vote which we are at risk of losing. We need to become better at communicating the work we are doing in so many areas to reflect the heartfelt views of British voters.” Mr Fabricant, who has previously called for an electoral pact with Ukip, added: “The Conservative Party needs to find itself a new voice that speaks with clarity to a sceptical and tired electorate.

“Unless we do that, and if Ukip is able to attract the finance and logistical skills it currently lacks to fight an effective general election campaign, then the dynamic of British politics might be changed for decades to come.”

Right-wingers protested that, under Mr Cameron, the party had lost its rapport with its natural supporters over such issues as Europe, immigration and gay marriage.

Stewart Jackson, who resigned as a ministerial aide over Europe, said: “He is out of touch with the party. Both gay marriage and EU migration feed into a narrative that too much emphasis is going to the liberal metropolitan elite and not enough to the blue-collar working vote Margaret Thatcher had the support of.”

Inside Politics newsletter The latest news on Brexit, politics and beyond direct to your inbox Enter your email address Continue Continue Please enter an email address Email address is invalid Fill out this field Email address is invalid Email already exists. Log in to update your newsletter preferences Register with your social account or click here to log in I would like to receive updates on politics every morning by email Update newsletter preferences

Douglas Carswell, the MP for Clacton, tweeted: “How to build an election-winning centre-right majority? Don’t alienate base in return for pundit applause. Pundits don’t have many votes.”

Eleanor Laing, the MP for Epping Forest, said many Tories felt “hurt and left out” under Mr Cameron’s leadership. She said: “They’re told they’re old-fashioned and they think they don’t matter.” The MEP Daniel Hannan said the Tories and Ukip should start “having conversations” and “stop calling each other names”.

One Tory MP said: “It was a bad result. But I think David Cameron is safe unless we do disastrously badly in the European elections next year.” But another said: “I can’t see how we’ll win the next election. The best we might hope for is another hung parliament, but with Labour as the biggest party.”

The result was a damaging setback for the Conservative chairman, Grant Shapps, as Eastleigh was among the 40 seats he had targeted for Tory gains at the next election. Mr Shapps said a poll conducted by Lord Ashcroft, the party’s former deputy chairman, found the Tories would have won in Eastleigh if a general election had been taking place.

The Prime Minister said: “In mid-term by-elections people want to register a protest, but I’m confident we can win those people back by demonstrating we are delivering for everyone who wants to work hard and to get on.”

Sarah Newton, a deputy Tory chairman, caused dismay among colleagues when she described the result as “good for the Coalition”. Senior Tories rapidly dismissed her comments.