Zimmermann (17-8) went five innings, allowing three runs on eight hits while walking one and striking out four.
Craig Stammen, Drew Storen and Tyler Clippard each threw a scoreless relief inning and Rafael Soriano finished up with his 40th save as Washington won a fourth straight and moved a season-high six games over .500 (75-69).
The Nationals were clinging to a 4-3 lead in the ninth when Adam LaRoche led off with a single against Frank Francisco. One out later, Tyler Byrdak relieved and Hairston, appearing as a pinch-hitter, blasted his first pitch into the left-field bleachers.
Jayson Werth (3-for-4, two RBI) and LaRoche also homered in the win.
New York's Dillion Gee (11-10) was touched for five runs on nine hits in a 6 1/3-inning performance.
Matt den Decker drove in two runs for the Mets.