Herrmann's shot, his first career walk-off homer, came on a 3-2 pitch from Rafael Montero (0-3) and sent the Mets to their seventh straight loss.
For the Mets, Wilmer Flores went 3-for-5 while Jose Reyes went 3-for-6.
Michael Comforto gave the Mets an early lead by hitting a two-run homer in the first. Juan Lagares hit a solo homer.
Mets pitcher Matt Harvey threw 5 1/3 innings, giving up three runs and six hits. He walked four and struck out six.
Harvey left with the Mets leading 4-3. Then Arizona's Yasmany Tomas doubled home Paul Goldschmidt, who had walked, to tie the game, 4-4, in the seventh.
For the Diamondbacks, Patrick Corbin gave up four runs and nine hits in six innings. He walked one and struck out six.
Neither starter figured in the decision.
Also for the Diamondbacks, Jake Lamb hit a two-run homer and drew two walks. Relievers Andrew Chafin, J.J. Hoover, Fernando Rodney and Jorge De la Rosa combined for four scoreless innings, while allowing just two hits.
With two outs in the top if the 11th, Tom Wilhelmsen (1-1) walked Matt Reynolds and Lucas Duda, but struck out Reyes to end the threat.
The Diamondbacks closed out their nine-game homestand at 6-3, including the three-game sweep of the Mets.
NOTES: Both teams will enjoy an off day on Thursday. After that the Mets will play a six-game homestand against the Los Angeles Angels and San Diego. By contrast, the Diamondbacks will play 17 straight days, with 14 of them on the road. Manager Torey Lovullo said this stretch "will define a little bit of who we are. Certain parts of the schedule that jump out at you. That was one." The D-backs will first play at San Diego, a team they've already played seven times (4-3) this season.... Mets LHP Steven Matz is scheduled to pitch for Class A St. Lucie Thursday. He has been on the disabled list since the start of the year with left elbow inflammation.... Mets RHP Seth Lugo is scheduled to pitch Thursday for Class A St. Lucie. He also has been on the DL since the start of the year with right elbow inflammation.