The Marlins trailed 4-3 going into the eighth against Bobby Parnell (3-2). Logan Morrison led off with a game-tying homer, and Mike Stanton singled. A sacrifice advanced the runner, and Buck put Florida ahead.
Buck, the Marlins' regular catcher, was pinch-hitting for only the third time this season.
Florida's Emilio Bonifacio singled leading off the first inning to extend his career-best hitting streak to 23 games, the longest active streak in the majors. Stanton hit his 22nd home run.
The Mets' David Wright homered for the first time since his return from a back injury that sidelined him for two months. He added a double and a single, and he has had two RBIs in all three of his games since being activated.
The Marlins finished 2-4 on their homestand after losing the first four games.
On a humid, 92-degree afternoon, Mets center fielder Angel Pagan left the game in the sixth inning because of dehydration, and the weather sapped both pitchers. New York starter Dillon Gee departed for a pinch hitter after five innings trailing 3-1.
Florida's Anibal Sanchez allowed 11 hits and four runs in seven innings. Hampered by poor run support, he has gone a career-high eight starts without a win.
The Mets had 12 hits but went 1 for 9 with runners in scoring position. Wright led off the fourth with a double before Sanchez retired the next three batters.
New York's Jason Bay singled home a run in the fifth, but Sanchez preserved a Florida lead by striking out the next two batters with runners at the corners.
The Mets went ahead in the seventh when Beltran singled with two out and Wright hit his first homer since May 13. Morrison tied the score with his 15th homer.
NL batting leader Jose Reyes started the game with a single and later scored on Beltran's sacrifice fly.
Florida pulled even in the bottom of the first. Bonifacio singled and swiped second for his 22nd stolen base, a career high. Omar Infante also singled, and Bonifacio scored on a groundout by Hanley Ramirez.
Stanton put Florida 2-1 with a homer leading off the second. Brett Hayes singled with one out, advanced on a sacrifice and scored on Bonifacio's two-out single.
Notes: Former NBA star Alonzo Mourning threw out the first pitch. ... Before the game, the Marlins recalled RHP Jose Ceda from Triple-A New Orleans. ... The Mets fell to 73-73 in Miami.