PHILADELPHIA (AP) — The New York Mets erased a six-run deficit with seven runs in the ninth inning, capping the rally with Starling Marte’s tiebreaking double to beat the flabbergasted Philadelphia Phillies 8-7 Thursday night.

With the Mets trailing 7-1, Marte led off the inning with an infield single against James Norwood and scored on Francisco Lindor’s two-run homer. Mark Canha added an RBI infield single that clanked off pitcher Corey Knebel, and J.D. Davis had a pinch-hit RBI double to rally the NL East-leading Mets.

READ MORE: 'It's Completely Polarized': Political Divide Hard To Ignore In Bucks County As Voters Come Out For Pennsylvania Primary

Brandon Nimmo then lined a tying, two-run single to center off Knebel. He came around to score when Marte ripped a double off the wall in center field.

READ MORE: Printer Error Affects Mailed Ballots In Lancaster County, Pennsylvania's 6th Most Populous County

It’s the first time New York trailed by at least six runs in the ninth and won since Sept. 13, 1997, when Carl Everett hit a tying grand slam with two outs in the ninth and the Mets went on to beat the Montreal Expos in extra innings.

MORE NEWS: Lt. Gov. John Fetterman To Undergo Surgery For Pacemaker Implant After Suffering Stroke

Bryce Harper and Nick Castellanos homered for the Phillies, and Aaron Nola pitched seven sharp innings. The Phillies have lost five of six.