Jose Reyes connected off Philadelphia Phillies closer Jeanmar Gomez, tying it 6-6 and forcing extra innings.
Asdrubal Cabrera then hit a three-run drive during an 11th-inning rally to lift the Mets to a dramatic 9-8 win over the Phillies that kept them tied atop the NL wild-card standings.
New York trailed 6-4 before pinch-hitter Brandon Nimmo singled off Gomez leading off the ninth and Reyes sent a changeup over the right-field wall with one out.
Philadelphia went ahead 8-6 in the 11th when A.J. Ellis hit an RBI single off Jeurys Familia and Jim Henderson (2-2) walked Maikel Franco with the bases loaded.
Pinch-hitter Michael Conforto walked against Edubray Ramos (1-3) with one out in the bottom half, Reyes singled and Cabrera, who has been playing with a strained left knee tendon, sent a slider soaring to right, setting off a wild celebration. The Mets had been 0-63 this year when trailing after eight innings.
New York stopped a three-game skid and remained tied with San Francisco for the NL wild-card spots.
Jeremy Hellickson (12-9) starts against the Mets for the fifth time this year on Friday. He has not allowed an earned run in his last 15 1/3 innings. RHP Gabriel Ynoa (1-0) will start in place of Steven Matz, who was scratched from his start Thursday.