The win allowed the Mets to break a six-game losing streak but New York need to come from behind to do so.
A.J. Ramos (0-1) came in to pitch for the Marlins and was greeted by a Valdespin drive into the right-field seats for a 5-4 New York lead.
It was Valdespin's second home run of the season. The other was a walk-off grand slam in the 10th inning last week against the Los Angeles Dodgers.
Dillon Gee (2-4), despite giving up four runs on nine hits over five innings, got the win and Bobby Parnell pitched one inning in getting his third save.
Wright and John Buck each had three this for the Mets.
Miami jumped out to a 3-0 lead in the first, with a two-run double from Chris Valaika the key hit. Wright hit his home run on the fourth but Juan Pierre singled in a run in the bottom of the inning to put the Marlins back up by three.
After the four-run Mets outburst in the sixth both teams scored twice in the seventh. Buck doubled in two for New York and Miami scored two runs on a Justin Ruggiano base hit.
Boston schools pull out free condoms over wrapping complaints
Millions of Getty images now available for free via embed tool