The Mets had scored two runs in the top of the ninth off closer Jonathon Papelbon (2-0), who blew his third straight save.
Ryan Howard homered twice and drove in four runs and Michael Young also homered for Philadelphia, which led 7-1 through six innings.
Jordany Valdespin homered off Papelbon with one out in the ninth to pull New York within 7-6. After David Wright reached on an error, Papelbon got Marlon Byrd to fly out for the second out.
With Wright running and shortstop Jimmy Rollins moving toward second base to cover, Daniel Murphy singled to left-center. Center fielder Ben Revere bobbled the ball and Wright scored all the way from first to tie the game at 7.
Papelbon started the week having converted all 13 of his save opportunities, but has blown three of his last four chances.
Frandsen gave him the win, though, by launching the second pitch from Carlos Torres (0-1) into the left-field stands.
Domonic Brown had a pair of doubles for Philadelphia, and Jonathan Pettibone allowed one run in six innings before leaving with a back injury.
Valdespin drove in three runs and Omar Quintanilla had three hits and an RBI for the Mets.
Howard continued his dominance of Dillon Gee, improving to 7 for 15 with six homers and 14 RBIs lifetime against the Mets right-hander. Gee also continued his struggles against the Phillies, allowing six runs (five earned) on eight hits in five innings. He is 2-3 with a 7.66 ERA in nine games (eight starts) in his career against Philadelphia. He entered 3-1 with a 1.53 ERA in his last four starts.
Howard's two-run single to right in the first gave Philadelphia a 2-0 lead. He led off the fourth with a solo homer to right and launched a two-out solo homer to deep right in the fifth. Young preceded Howard's second homer of the game with a solo shot of his own. Young also has success against Gee, improving to 8 for 11 with three homers against him.
Pettibone appeared to injure himself while batting in the sixth inning. He drew boos when he didn't run out a weak grounder, but clearly there was something bothering him as he clutched his lower back on his way back to the dugout. Pettibone warmed up before the seventh, but exited without throwing a pitch in the inning. The Phillies announced later in the game that he was experiencing lower back tightness.
He left with the Phillies ahead 7-1 after allowing one run on five hits with a walk and a strikeout in six innings.
The Phillies needed three relievers to get through the seventh when the Mets scored four runs on two hits.
Michael Stutes relieved Pettibone but didn't get any of the four batters he faced out, giving up four runs (three earned) on one hit and two walks. Eric Young's two-run double to left off Justin De Fratus pulled New York within 7-4. After Valdespin's groundout made it 7-5, De Fratus struck out Wright and, two batters later, Jake Diekman came on and struck out Murphy to end the threat.
Revere had a pair of hits and an RBI for Philadelphia to extend his hitting streak to 12 games.