Flores, who received a standing ovation before each at-bat, hit a 1-1 pitch from Felipe Rivero over the left-centerfield fence to give the Mets the win and bring them within two games of first place in the NL East.
Harvey, who took a perfect game into the sixth, struck out nine in 7 2/3 innings, giving up four hits and one run. The Mets had a 1-0 lead with two outs in the eighth, but Harvey hit Clint Robinson in the foot with a pitch. Anthony Rendon followed with an infield single to third to bring up Yunel Escobar, who singled through the middle to tie the game at 1.
Terry Collins then brought in Tyler Clippard, who struck out Jayson Werth in a 13-pitch at-bat to escape the two-on, two-out jam. Jeurys Familia pitched 1 2/3 scoreless innings, Hansel Robles tossed a scoreless 11th and Carlos Torres (4-4) had a 1-2-3 12th inning.
The Mets (53-50) made Nationals starter Gio Gonzalez labor, as he left the game in the fifth inning after throwing 105 pitches.
The Mets and Nationals play the second game of a three-game series Saturday at 7:15 p.m.
Jacob deGrom (10-6, 2.05 ERA) takes the mound for the Mets and will face Joe Ross (2-3, 3.03 ERA).