NEW YORK — The Union’s hopes of a miracle run to first place in the Eastern Conference moved a big step closer to extinction Wednesday night at Yankee Stadium. East-leading New York City FC thumped second-place Alanta United, 4-1, led by a first-half hat trick from Alexandru Mitriță.

But New York’s win wasn’t actually that bad for the Union overall. It gave them a chance to jump over Atlanta into second place, which they did with a stunning 2-1 comebck win at the San Jose Earthquakes in the early hours of Thursday morning.

And because of that combination of results the Union still have an outside shot to beat New York to first.

The Union would need to win at Columbus on Sunday (5 p.m., PHL17), and have New York lose at New England (played at the same hour). The gap between the teams would then be three points heading into the Union-City game in Chester on the last day of the regular season. A Union win from there would give them first place on the first tiebreaker of total wins (it would be 18-17).

So New York (17-5-10, 61 points) rightly wasn’t celebrating anything yet after the final whistle Wednesday night.

“Our destiny was in our hands, and we knew if we came out and won this game it would give us a really good shot at winning the East,” veteran New York goalkeeper Sean Johnson said. “Everything else is out of our control, but we did what we had to do tonight, and I think it’s a group that’s hungry for more.”

The Pigeons, as they’re nicknamed locally, knew this might not be their last meeting with Atlanta this year. The odds are good that they’ll clash in the playoffs, and by then Atlanta (17-12-3, 54 points) might have star striker Josef Martínez back from a leg injury suffered last Saturday.

New York might also see the Union more than once in the coming weeks, especially if Philadelphia is able to finish second. That would put the Union on track to host first- and second-round playoff games, then potentially play at NYCFC in the Eastern Conference final.

City might even have another meeting with the Revolution after Sunday’s game. New England is in contention for the East’s 7th and final playoff spot. Whichever team gets it will visit the No. 2 seed in the first round. New England, one of four contenders, drew 2-2 at Portland late Wednesday night.

“You might as well keep going down the list — you never know,” Johnson said. “We know that we’re going to be in the playoffs, and we know we’re going to have to keep the standard [up]. … No matter who we play against, it’s going to be at home, which is a big things for us.”

The definition of “home,” though, won’t necessarily be Yankee Stadium. If the Yankees make a deep run in baseball’s playoffs, City would be kicked out of the Bronx and forced to find another place to play.

The Eastern Conference semifinal round (Oct. 23-24) and final (Oct. 29-30) would overlap with the World Series — Games 1 and 2 in the first window, and potential games 6 and 7 in the second. MLS’ first playoff round (Oct. 19-20) overlaps with potential Games 6 and 7 of the American League Championship Series.

On top of all that, there’s a Princeton-Dartmouth college football game at Yankee Stadium on Nov. 9, the day before the MLS Cup final.

In past years, NYCFC has played autumn games at the Mets’ Citi Field in Queens and the University of Connecticut’s Rentschler Field in East Hartford. A club spokesperson said contingency plans will be announced soon.

The Athletic reported Thursday afternoon that NYCFC has been in talks with the Mets about playing all of its postseason games at Citi Field, and reported that an announcement of plans is expected next week.

If New York does finish atop the East, it would be at least 17 days between games of consequence. Finish the job sooner, and the gap only grows. That fact has gotten plenty of attention in City’s locker room.

“We’ll approach the last two games in a professional manner,” Johnson said. “You’re going to see a team that’s hungry to win. We’re not going to ease up just because [or] if we’re in first place going into the last two games and we’ve clinched.”