It was the stuff of slow-pitch softball games, with so many liners filling the hot air over Citi Field that even a relief pitcher couldn’t help but get a piece of the action.

In Thursday night’s showdown of the top two teams in the NL East, the Nationals and Mets totaled 16 runs and 27 hits, 14 for extra bases. The outburst included eight homers — a Citi Field record — with two of them into the batter’s eye in center and two into the upper deck in right.

There were 310 pitches thrown, and though none of them came in underhanded, it seemed that way. How else to explain Nationals reliever Ollie Perez, the scorned former Met? He had been hitless in six years but nonetheless collected a pair of hits, including one that ignited a rally.

But once the dust settled on one of the weirdest nights in the history of Citi Field, the Mets emerged as 9-7 winners over the Nationals, and Wilmer Flores again had delivered a clutch hit against his team’s most bitter rival.

With three games left before the All-Star break, the Mets have cut their deficit in the division to three games after falling as far as six behind.

“I just felt coming into the homestand we needed to make up some ground,” manager Terry Collins said.

advertisement | advertise on newsday

It ended in controversy, with the Mets benefiting from an illegal-slide call in the ninth. Jayson Werth slid into second base late, and the umpires determined that it violated the rules that came from Chase Utley’s brutal takeout of Ruben Tejada in last year’s NLDS.

With that, Daniel Murphy’s hard grounder, stopped only with a diving effort by shortstop Asdrubal Cabrera, became a critical double play that helped Jeurys Familia escape a jam.

Bryce Harper struck out swinging to end the game.

“To me, that’s a clean slide,” Werth said. “It’s been a clean slide for over 100 years. There were no spikes involved. I was down early.”

The go-ahead homer came off the bat of the scorching Flores, who blasted a three-run shot in the fifth to give the Mets their first lead. Improbably, it stuck.

Mets videos

Flores didn’t even start the game. As expected, he was squeezed out of the lineup, with Collins resolving to give playing time to Jose Reyes. Nevertheless, Flores entered the game in a double switch, then blasted his fifth homer since Sunday.

“We’re ready. We’re not going to put our heads down even when we’re missing players,” Flores said.

Twice the Mets fell behind, only to tie it. In the fifth, the Nats went ahead 6-4. Only then did the Mets finally go ahead on Flores’ timely swing. The homer injected life into a vocal crowd on a sticky, humid night. They cheered for a curtain call, and Flores finally obliged.

Of course, it wasn’t the first time on a strange night that they had expressed their emotions.

They showered boos upon old friends (Murphy for knocking in three runs and Perez for, well, being Perez), old foils (Harper for blasting a mammoth homer) and old stars (Reyes for getting picked off first base even though he had homered earlier).

advertisement | advertise on newsday

Murphy continued his tear. In 10 games against his former mates, he has 14 RBIs, the latest on a seventh-inning solo shot off Antonio Bastardo.

The Nationals clubbed three homers in the fourth against Bartolo Colon, who endured his worst start of the season. The Mets answered with a pair of solo blasts from Reyes and Travis d’Arnaud in the fourth. Cabrera hit a solo shot in the sixth.

Indeed, it was a brutal night for the pitchers.

Said Reyes: “Any way that we win the game, we’ll take that.”