Just three hours later, ministers caved in.
The Lords amendment number 25, which was voted through by MPs last night, states that the United Kingdom government must not do anything which is incompatible with the Northern Ireland Act 1998.
In the tense atmosphere where it was not clear which way the vote would go, the government secured its victory only after offering concessions to one of the leaders of a group of Conservative lawmakers who were threatening to vote against May.
May met with more than a dozen Tory would-be rebels shortly before the vote to reassure them, although exactly what she promised is in dispute.
All members of the European Union also belong to the EEA, alongside non-EU countries Norway, Iceland, and Liechtenstein.
Davis warned lawmakers the government would never allow them to "reverse Brexit" and called on them to back its own amendment, which proposes a 28-day breathing space if parliament rejects a Brexit deal, during which the government would have to make a statement on its plans.
But in unusual scenes, ministers were forced to offer a last-minute compromise to pro-European MPs, negotiated in part in huddles in the chamber as the debate raged.
The government has avoided a major defeat on its Brexit bill by 324 votes to 298 after a late concession.
Flint said she could not support EEA membership because it would mean there would be no restriction on free movement.
However, Devon Tory Sarah Wollaston signalled that she would back Mr Grieve's amendment.
The government was putting a combative spin on the concessions Tuesday evening: "The Brexit Secretary has set out three tests that any new amendment has to meet - not undermining the negotiations, not changing the constitutional role of Parliament and Government in negotiating global treaties, and respecting the referendum result", a spokesperson for the Brexit department said in a statement.
Theresa May has suffered a ministerial resignation ahead of crunch Commons votes on Brexit, with Phillip Lee hitting out at the Government's "irresponsible" approach. A total of 89 Labour MPs defied Corbyn in the vote on this amendment, making it the party's biggest Brexit rebellion yet.
Talks with Brussels have stalled over the fraught issue of the Irish border, but both sides are hoping to agree a final deal by October in time for the break on March 29, 2019.
There was little doubt the government would win on the customs union and single market, which some pro-EU lawmakers say is the only way for Britain to retain economically advantageous close ties with the bloc, with the opposition Labour Party also divided over future relations.
If May is defeated in the House of Commons it will be yet another blow to a prime minister whose authority has been challenged several times since last year's election.
The most contentious was the bid to give Parliament the power to tell the government what to do if the Brexit deal was voted down or no agreement was reached.