Just two months ago, George Santos’s expulsion from the House looked like everything Democrats could have asked for. It gave them an open Republican seat in a winnable New York district, with an electorate still reeling from the congressman’s spectacular unraveling.

The party even had a name-brand candidate, Tom Suozzi, who had won the seat easily three times before.

But with less than a week to go before the Feb. 13 special House election, a wave of suburban discontent fueled by the crush of migrants arriving at the southern border and in New York City has helped transform a potential Democratic pickup into a statistical dead heat.

“If I run my campaign and just say, ‘I’m Tom Suozzi, I’m a Democrat and my opponent is a Republican,’ I’ll lose this race,” Mr. Suozzi told union carpenters on Saturday at a rally on Long Island. “People are upset Democrats haven’t been tough enough on things like the border.”

“Exactly!” “That’s right!” “Yes, sir,” some in the crowd hollered in approval.

“I’m tougher than you’ll ever be,” Mr. Suozzi razzed back.

Republicans would disagree. They have seized on the issue in a vivid preview of their strategy for the November general election, spending millions of dollars blanketing the Queens and Long Island swing district in ads creating an image of Mr. Suozzi as a feckless proponent of open borders.