The Mets snapped a six-game losing streak by giving St. Louis only its third loss in 15 games.
Murphy and David Wright, hitting second and third in the New York order, combined for six hits, three runs scored and three runs batted in.
Murphy doubled in Jordany Valdespin and scored on a Wright single in the third to erase a 1-0 St. Louis lead. Murphy doubled and scored on Wright's double in the sixth, and Wright made the score 4-1 on Lucas Duda's sacrifice fly.
Duda scored on a John Buck single when the Mets added an insurance run in the eighth.
Jon Niese (3-4) was charged with both St. Louis runs as he allowed six hits and walked two over 7 1/3 innings. The first four New York runs were allowed by Adam Wainwright (5-3), who gave up six hits and walked one while striking out eight in six innings.
Bobby Parnell pitched a one-hit ninth for his fourth save.
Celebrity Breakups and divorces of 2014 [PHOTOS]