NEW YORK -- Right-hander Jacob deGrom tossed seven strong innings Friday night to pick up the win after the New York Mets scored three unearned runs in bizarre fashion in the bottom of the seventh inning of a 4-1 victory over the Philadelphia Phillies at Citi Field.

The Mets (63-72) avoided falling into last place in the National League East for the first time since June 27 -- the last date in which the Phillies (61-73) were not in last place.

The Mets broke a 1-1 tie without a base hit in the seventh inning. Left fielder Matt den Dekker drew a one-out walk off left-hander Jake Diekman (3-4) and stole second. With two outs, shortstop Wilmer Flores was hit by a pitch.

Eric Campbell, pinch-hitting for deGrom, drew a full-count walk to load the bases. Center fielder Juan Lagares followed with a seemingly routine fly to left, but Grady Sizemore dropped the ball as he pulled the glove down and den Dekker and Flores raced home.

Three pitches later, Lagares took off for second and Campbell bolted for home when catcher Carlos Ruiz threw to second. Campbell beat the throw home for his second career stolen base and the Mets' first steal of home since Jason Pridie did it on May 15, 2011.

Catcher Travis d'Arnaud had an RBI single in the fourth inning for the Mets. Second baseman Dilson Herrera went 0-for-3 with an error in his major league debut.

DeGrom (7-6) allowed an unearned run, four hits and two walks while striking out five in his first win since Aug. 2. Right-hander Jeurys Familia allowed one hit in the eighth and right-hander Jenrry Mejia earned his 20th save by striking out the side in a hitless ninth.

Phillies third baseman Cody Asche had an RBI single in the seventh inning and second baseman Chase Utley had two singles.

Phillies right-hander David Buchanan allowed one run, four hits and one walk while striking out three in six innings.

NOTES: Mets 2B Dilson Herrera made his major league debut one year and two days after he was acquired from the Pittsburgh Pirates along with a player to be named in exchange for C John Buck and OF Marlon Byrd, the latter of whom now plays for the Phillies. The player to be named in the deal was RHP Vic Black, whom the Mets placed on the 15-day disabled list Thursday. ... Herrera might take over at second base for a while because both manager Terry Collins and general manager Sandy Alderson indicated 2B Daniel Murphy need more than a minimum stay on the disabled list. ... Manager Ryne Sandberg said the Phillies could promote five or six players once rosters expand Monday. ... Phillies RHP David Buchanan is the first Georgia State University alum to reach the major leagues.