Wright homered twice and matched a career high with six RBIs. The Mets scored five runs off the Phillies bullpen in the final two innings to stun the NL East leaders. Madson blew his sixth save.
Madson (5-5) had retired the first two batters in the ninth before Fernando Tatis singled. Wright then hit the next pitch into the left-field seats for his 10th homer of the season.
Pedro Feliciano (6-4) got the final out in the eighth inning for the win. Francisco Rodriguez pitched the ninth for his 31st save.
Chase Utley, Raul Ibanez and Pedro Feliz all homered for the Phillies.
Wright hit a two-run shot in the eighth, his first homer since Aug. 5, off Brett Myers that made it 9-7. Myers and Madson gave up all five runs in the last two innings.
Trailing 9-8, the Mets wasted a chance to take the lead in the eighth after putting runners on the corners and two outs. Chan Ho Park retired pinch-hitter Cory Sullivan to end the threat and seemingly preserve the win for Philadelphia starter Jamie Moyer.
It all unraveled for the Phillies in the ninth.
Madson has been closing games since Brad Lidge, last year's perfect World Series championship star, lost his job this week with one meltdown after another.
The Phillies need to find a reliable a closer heading into October if they want to have any chance of a repeat.
While the Phillies are struggling holding leads in the ninth, Moyer seems to have regained his form.
He rebounded from a four-run first inning to retire 14 straight in one stretch. Yanked from the rotation last month in favor of Pedro Martinez, Moyer made the most of his second straight start in place of injured J.A. Happ.
The Phillies entered with a six-game lead in the East over Florida -- a solid lead, though not a sure sign of a division title. The Mets led the NL East at this point in each of the last two years, only to collapse and yield the division to Philadelphia. The Mets blew a seven-game lead with 17 games to play in 2007.
The injury-riddled Mets have long been out of contention this season. Coming off his strongest outing of the year in a win against Chicago, Mike Pelfrey couldn't hold the early lead or get that crucial third out.
With two outs in the second, Feliz hit a two-run shot that cut New York's lead to 4-2. His 11th homer was Philadelphia's 200th of the season in 140 games, the fastest they have reached that long ball milestone.
Pelfrey retired the first two batters in the third only to have Utley and Ibanez each hit their 31st homers. Ibanez pulled the ball into the right-field seats for a two-run shot that put the Phillies ahead 5-4.
Jimmy Rollins added run-scoring hits in the fourth and sixth that padded Philadelphia's lead.
It just wasn't enough, and the Mets got a rare fantastic win in a season that has mostly been devoid of them.
Mets manager Jerry Manuel didn't know Derek Jeter broke the Yankees career hit record on Friday night. "Derek break the record? Single? Double? Game winner?" ... Phillies RHP Kyle Kendrick (0-1) will start Game 1 of Sunday's day-night doubleheader. Kendrick won 21 games over the last two seasons, but failed to win a spot in the rotation in spring training and was sent to the minors. He called his demotion a "humbling experience." "It's only one start, but it would be nice to show what I learned and what I accomplished," he said.