The previous 330 times the New York Mets trailed by six runs in the ninth inning, they had lost.

"I’m sure everyone counted us out," Brandon Nimmo said. "These guys, they don’t give up. With that mentality, anything is possible."

The Mets staged a most remarkable comeback Thursday night, erasing a six-run deficit in the ninth inning to beat the flabbergasted Philadelphia Phillies 8-7.

Nimmo delivered a tying, two-run single, then scored on Starling Marte's tiebreaking double to end a string of 857 consecutive losses by MLB clubs when trailing by six runs or more in the ninth, according to the Elias Sports Bureau.

CLICK HERE FOR MORE SPORTS COVERAGE ON FOXNEWS.COM

New York Mets' Starling Marte hits a run-scoring double against Philadelphia Phillies pitcher Corey Knebel during the ninth inning of a baseball game, Thursday, May 5, 2022, in Philadelphia. 

New York Mets' Starling Marte hits a run-scoring double against Philadelphia Phillies pitcher Corey Knebel during the ninth inning of a baseball game, Thursday, May 5, 2022, in Philadelphia.  (AP Photo/Matt Slocum)

"I’m an optimist, I just keep going until they blow the whistle," Nimmo said. "You just never give up. The stats can say all they want. They can say it can’t be done. But that’s why you play the game."

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 (0-2), and J.D. Davis had a pinch-hit RBI double before Nimmo and Marte finished off the high point of the NL East-leading Mets' season so far.

"Just strung a lot of good at-bats together by good hitters," Mets manager Buck Showalter said.

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. It was just the third time in Mets history they have come back from at least six runs down in the ninth to win, according to Elias.

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

"That’s about as hard as I’ve been through," Phillies manager Joe Girardi said. "This is as tough as it gets."

Marte also had a solo homer in the sixth.

The Mets avoided consecutive losses for the second time this season in amazing fashion, continuing the optimism in New York after a fast start.

"Nights like tonight make you realize what it can be," Showalter said.

It looked like Nola was going to earn his second victory when the Mets came to bat in the ninth having scored just one run on three hits.

Edwin Diaz pitched a scoreless ninth for his sixth save in seven chances. Adonis Medina (1-0) allowed one hit in 2 2/3 scoreless innings.

PHILLY’S FAST START

Philadelphia jumped on Taijuan Walker for four runs in the first inning.

Harper had an RBI double, J.T. Realmuto and Jean Segura added RBI singles and Castellanos had a run-scoring groundout. The Phillies were helped by a costly error by shortstop Lindor on Alec Bohm’s grounder early in the inning.

Philadelphia went in front 7-0 in the fourth on back-to-back homers by Harper and Castellanos.

WALKER’S NIGHT

Walker, making just his third start due to a stint on the injured list with a shoulder injury, lasted just four innings and surrendered six earned runs on nine hits with two strikeouts and two walks. All three of his outings have been against Philadelphia.

TRAINER’S ROOM

Phillies: Castellanos left the game in the sixth inning after getting hit by an 86-mph changeup from Medina. Castellanos has a right wrist contusion. X-rays were negative and he is day-to-day, the Phillies said.

UP NEXT

Mets RHP Max Scherzer (4-0, 2.61) is scheduled to face Phillies RHP Kyle Gibson (2-1, 2.93) in the second game of the four-game set on Friday night.