David Aardsma (2-0) pitched an inning in relief of Jeremy Hefner for the win. Bobby Parnell retired Giancarlo Stanton with runners on first and third to end it for his 21st save in 25 opportunities.
Jeff Mathis drove in two runs for Miami.
Miami's Jacob Turner was in line for the win when he was pulled with a 5-3 lead after 6 1-3 innings. But Miami relievers Mike Dunn and A.J. Ramos (3-4) struggled to get out of the seventh as the Mets scored three runs.
Murphy's RBI single off Dunn pulled the Mets to 5-4. Ramos then relieved Dunn and gave up a tying hit by Marlon Byrd. Davis' double to right field scored Byrd, who slid in safely just below the tag of catcher Mathis to give the Mets a 6-5 lead.
Parnell, New York's fifth pitcher, allowed a one out pinch-hit single to Greg Dobbs in the ninth. Pinch-runner Juan Pierre stole second with two outs. Christian Yelich walked and Pierre advanced to third on defensive indifference setting it up for Stanton, who grounded out to first base to end the game.
The Mets scored three runs in the third inning with two outs to go up 3-0. Murphy started the scoring with a two-run single and scored on an RBI double by David Wright.
Miami's Ed Lucas tripled to deep center to score Stanton to cut the deficit to 3-1 in the fourth.