Theresa May has survived as prime minister after weathering a dramatic no-confidence vote in her government, but was left scrambling to strike a Brexit compromise that could secure the backing of parliament.

In a statement in Downing Street on Wednesday night, the prime minister exhorted politicians from all parties to “put aside self-interest”, and promised to consult with MPs with “the widest possible range of views” in the coming days.

It followed her announcement that she would invite Jeremy Corbyn and other party leaders for immediate talks on how to secure a Brexit deal, something she had declined to do earlier in the day, although Labour later said Corbyn would decline the invitation unless no-deal was taken off the table.

May keen to start alternative Brexit talks after no-confidence motion fails – Politics live Read more

A day after overwhelmingly rejecting her Brexit deal, rebel Conservatives and Democratic Unionist party (DUP) MPs swung behind the prime minister to defeat Labour’s motion of no confidence by 325 votes to 306 – a majority of 19.

In her late-night statement, the prime minister said: “I am disappointed that the leader of the Labour party has not so far chosen to take part – but our door remains open … It will not be an easy task, but MPs know they have a duty to act in the national interest, reach a consensus and get this done.”

The Scottish National party’s leader in Westminster, Ian Blackford, met May on Wednesday night, and the Liberal Democrat leader, Vince Cable, also accepted her invitation.

Blackford later wrote to May, urging her to make a “gesture of faith” to show that she was serious. He said the SNP would take part in cross-party talks if she was able to confirm “that the extension of article 50, a ruling out of a no-deal Brexit and the option of a second EU referendum would form the basis of those discussions”.

With just five days to go before May must make a statement to parliament setting out her Brexit plan B, Downing Street continued to indicate that she was not ready to budge on her red lines, including membership of a customs union.

Conservative politicians are deeply divided about how May should adapt her deal to win over hostile MPs.

The South Cambridgeshire Tory MP, Heidi Allen, said: “I thought she was incredibly brave [after the Brexit defeat] and it felt like she got that we need to change. But today it was: ‘I’ll talk to people, but my red lines are still there.’ And that’s not going to work at all.

“Maybe the prime minister needs a little bit longer but she has got to reflect: stop pandering to the hard right of my party and start talking to those of us who have been working across parties for months. We’re a functioning, collaborative body already. She just needs to tap into us.”

Some cabinet ministers clearly indicated the need for flexibility. The justice secretary, David Gauke, warned that the government should not allow itself to be “boxed in”, and Amber Rudd suggested a customs union could not be ruled out.

Labour has not ruled out tabling further no-confidence votes in the days ahead, in the hope of peeling off exasperated Tory rebels and triggering a general election. But on Wednesday night other opposition parties sent a letter to Corbyn, which said they expected him to honour his promise to back a public vote if Labour failed to get an election.

Play Video 10:04 Go behind the scenes with three MPs caught up in Brexit vote chaos – video

A Lib Dem source suggested the party may not back future no confidence votes if it felt they were a way to evade the issue. “We will support any real opportunity to take down the Tories with relish. We will not be party to Corbyn using spurious means to avoid Labour policy, by pursuing unwinnable no-confidence votes,” the source said.

The DUP was quick to stress that without its 10 MPs, the government would have lost the confidence vote, and called on May to focus on tackling their concerns with the Irish backstop.

“Lessons will need to be learned from the vote in parliament. The issue of the backstop needs to be dealt with and we will continue to work to that end,” said Nigel Dodds, the DUP leader at Westminster.

May’s spokesman said a no-deal Brexit could not be ruled out. However, the Daily Telegraph claimed to have got hold of a recording of Philip Hammond speaking to business leaders on Tuesday night in which the chancellor said the threat of a no-deal could be taken “off the table” within days.

May’s spokesman suggested a customs union was not up for discussion: “We want to be able to do our own trade deals, and that is incompatible with either the or a customs union.”

After meeting party leaders, May is expected to extend the invitation to opposition backbenchers over the coming days, as well Tory Eurosceptics.

What are the alternatives to May's rejected Brexit deal? Read more

“We want to find a way forward and we are approaching this in a constructive spirit,” May’s spokesman said. “We’ve set out the principles but clearly there is an overriding aim – to leave the European Union with a good deal – and we are open-minded.”

Civil servants and political staff are likely to attend the meetings, and ministers can direct civil servants to draw up more concrete plans where necessary, but the talks will not have the same formal status as coalition negotiations.

Wednesday’s vote followed an ill-tempered debate in which Corbyn accused May of presiding over a “zombie government”.

“It is clear that this government are not capable of winning support for their core plan on the most vital issue facing this country. The prime minister has lost control and the government have lost the ability to govern.”

Labour’s deputy leader, Tom Watson, wound up the debate for his party by saying May would for ever be known as “the nothing-has-changed prime minister”.

“No one doubts her determination, which is generally of an admirable quality, but, misapplied, it can be toxic,” he said. “And the cruellest truth of all is that she doesn’t possess the necessary political skills, empathy, ability, and most crucially, the policy, to lead this country any longer.”

The environment secretary, Michael Gove, responded with a robust speech widely regarded at Westminster as a leadership pitch, praising May’s “inspirational leadership” and attacking Corbyn on issues from antisemitism to foreign policy.

“If he cannot protect the proud traditions of the Labour party, how can he possibly protect his country?” he asked.

One former Labour MP, John Woodcock, who resigned from the party after being investigated over sexual harassment claims, abstained from the vote, saying Corbyn was “unfit to lead the country”.

Had the motion passed, MPs would have had 14 days for an alternative government to emerge that could command a majority in the Commons, or a general election would have been triggered.

Corbyn is now likely to come under pressure from party activists to move towards supporting a second referendum. A group of more than 70 Labour MPs announced on Wednesday morning that they were backing the call for a “people’s vote”.

Labour’s formal position, adopted at its conference in Liverpool last year, commits the party to press for a general election. Failing that, all options are on the table, including that of campaigning for a second referendum.