Zack Wheeler expected to be pitching in a playoff chase this month. As of two weeks ago, that meant his bags were packed — a recommendation from General Manager Brodie Van Wagenen as the trade deadline neared, rumors swirled and the Mets trailed 12 teams in the National League standings.

The right-hander was going to land with whichever contender wanted him most. Improbably, that turned out to be the Mets.

Wheeler ground up Miami over eight innings on Tuesday, Wilson Ramos and Pete Alonso homered, and the Mets beat the Marlins, 5-0, for their 12th win in 13 games, including five of six since the deadline. The hard-charging Mets improved to 58-56 a night after surpassing the .500 mark for the first time since early May.

“We know how good we can be and how good we are,” Wheeler said. “We’re shooting for it.”

New York has the best record in baseball since the All-Star break and entered the day two and a half games behind Philadelphia for an N.L. wild card despite looking like a surefire seller in late July — two weeks ago, the Mets trailed every N.L. team except the Marlins and Pirates.