NEW YORK -- Don’t despair too much about Matt Harvey’s predicament. The New York Mets remain in a legitimate battle for first place in the National League East.

Wilmer Flores provided the heroics -- again -- as the Mets rallied for a 9-7 win against the first-place Washington Nationals on Thursday at Citi Field in the opener of a four-game series.

Despite a pair of two-homer games this week, Flores had not been in Thursday’s starting lineup as he began to recede to a backup infield role now that Jose Reyes is on board. However, shortly after Bartolo Colon was knocked out in the fifth inning, Flores entered on a double-switch. Half an inning later he delivered a three-run homer that gave the Mets their first lead after early deficits of 4-1 and 6-4.

Since getting swept in Washington in late June while going scoreless during a season-high 23-inning stretch, the Mets (47-38) have won seven of eight games. They have now moved to within three games of the division lead with the All-Star break looming.

“When we went in there and got swept, you’re looking at six games back,” Mets manager Terry Collins said. “It’s pretty dangerous if you get too much farther back. So I just thought coming into the homestand that we had to make up some ground.”

Amid pregame news that Harvey is considering season-ending surgery to address thoracic outlet syndrome, Collins had dryly said: “I don't want it to sound like woe is me, but woe is us.”

Hours later, the series opener against the Nationals (51-36) took a turn for the worse when Bryce Harper, Clint Robinson and Anthony Rendon all delivered solo homers in the fourth inning against Colon. The last Mets pitcher to allow three homers in an inning also was Colon -- on April 13, 2014, in his third appearance as a Met, when Mike Trout, Albert Pujols and Raul Ibanez all took him deep in the first inning at Anaheim.

Wilmer Flores took a curtain call after his home run in the fifth inning. Brad Penner/USA TODAY Sports

After eight straight starts allowing two runs or fewer, Colon had a stinker. He allowed six runs on a season-high 10 hits in 4⅔ innings. Collins wondered if a recent leg issue hampered Colon, but the righty said he got treatment pregame and it was not an impediment.

It was a game filled with oddities. Ex-Met Oliver Perez, pitching in relief after Nationals rookie Lucas Giolito lasted only 3⅔ innings, went 2-for-2 at the plate and scored a run. Perez last had a two-hit game on May 2, 2007, with the Mets against the Marlins.

Reyes also got into the act, producing his first homer with the Mets since Sept. 27, 2011. The shot induced that familiar “Jo-se, Jo-se” soccer-style chant from the pro-Mets crowd. The teams combined for a Citi Field-record eight homers.

The night, though, belonged to Flores, who turned a two-run deficit into a 7-6 lead with his fifth-inning long ball against Perez.

"I wasn't playing today," Flores said. "I got the opportunity to go out there. And I was just ready for him. I faced him a couple of times. The first pitch I saw, I put a good swing on it."

The Mets then opened a two-run cushion on Asdrubal Cabrera’s homer against Matt Belisle in the sixth. Antonio Bastardo gave that run back a half-inning later when he served up a leadoff homer to Daniel Murphy, who now has five homers and 14 RBIs in 10 games against the Mets.

Flores’ previous homer against the Nationals came on July 31, 2015 -- two days after his trade with Zack Wheeler to the Milwaukee Brewers fell through. That long ball was a walk-off shot in the 12th inning that helped turn around the Mets’ season en route to overtaking the Nationals for first place in the National League East.

“That’s the first thing I thought of -- that, this guy gets huge hits against these guys in big situations,” Collins said. “We said before the game: When you’ve got some guys that are swinging the bats great, the nights they’re not playing, you can use them sporadically when you need somebody to come off the bench and get a big hit. And he did that.”

Said Flores: "This is definitely a similar series."

Did the Mets begin a similar climb to overtake Washington behind another Flores homer on Thursday? Stay tuned.

What’s next: In a battle of starting candidates for the NL in the All-Star Game, Noah Syndergaard (9-3, 2.41 ERA) opposes right-hander Stephen Strasburg (11-0, 2.71) on Friday at 7:10 p.m. ET.