Matt Kemp flied out to open the 13th before Loney blasted a 1-0 offering over the wall in right-center field for his seventh long ball of the year.
"It felt pretty good when I hit it," said Loney about his game-winner. "I said to myself if that doesn't go out, something's wrong. If you're going to play a long game like that, it always feels good when you win."
Perez was brought on to face Andre Ethier, who fouled out for the second out before Rafael Furcal was intentionally walked to load the bases. Pinch-hitter Jamey Carroll bounced into a force play to end the threat.
Furcal started the home first with a single, moved to third base on an errant Mike Pelfrey pickoff attempt and scored on Xavier Paul's sacrifice fly.
Kemp and Loney followed with singles but Pelfrey escaped further damage by getting two groundouts to end the frame.
New York loaded the bases with one out in the fourth but could not score after Rod Barajas struck out and Pelfrey grounded out.
Blake DeWitt led off the bottom of the inning with a triple and stayed put after Casey Blake struck out and Anderson was intentionally walked. Brad Ausmus then came through with a base hit to plate DeWitt to make it 2-0.
Pelfrey was charged with both runs on six hits and a pair of walks over five innings, while Los Angeles starter Carlos Monasterios went five scoreless frames in his first start since June 18, allowing six hits while walking one and fanning three.
James McDonald opened the sixth on the hill for the Dodgers. and gave up a one-out double to Ike Davis and walked Jason Bay before Barajas singled to left to deliver Davis, cutting the deficit in half.
After a couple of matchup switches, pinch-hitter Jeff Francoeur reached on a fielder's choice to load the bases with one out. Jose Reyes singled to drive in Bay, tie the game, and chase Jack Taschner after he had faced only two batters. Travis Schlichting took over and got Luis Castillo to ground into an inning-ending double play.
"We need to figure out how to score," said Reyes about his team's offensive struggles. "Our pitchers are doing well. We're trying but we have to continue to stay focused and play better baseball."
Barajas left the game in the sixth inning with a strained right oblique...The Mets have been held to four runs or fewer in 14 of their last 15 games and have scored multiple runs in only three of 99 innings since the All-Star break...Wright has scored only one run in his last 14 games and driven in just four over his last 17 games...Reyes went 2-for-5 and has hit safely in 10 of his last 12 games...Los Angeles is 6-3 in extra innings games, while the Mets are 4-7...The Dodgers have won seven of the last nine meetings on home soil.