Christian Yelich's two-out single with the bases loaded brought in the winning run as Miami claimed a 4-3 victory over Philadelphia in the finale of a three-game set.
Marlon Byrd had tied the game in the eighth with a two-run homer, but Jake Diekman (2-2) undid that in the last of the ninth.
He let Marcell Ozuna reach with a one-out single and then Jeff Mathis kept the inning alive with a two- out base hit. Pinch-hitter Reed Johnson's infield hit loaded the bases, before Yelich lined a ball through the left side of second base to score Ozuna and end the game.
Steve Cishek (4-1) fanned two in a scoreless top of the ninth.