MIAMI -- On a night in which 6-foot-6, 250-pound Giancarlo Stanton slugged two homers and nearly a third, it was perhaps the smallest player on the field who won the game.
Gordon, who was the sixth hitter due up in the 10th, was in the clubhouse watching video of Phillies reliever Mark Leiter (1-2) when things changed quickly.
With one out, Derek Dietrich tripled to right field as Ty Kelly -- normally a backup infielder -- crashed into the wall. The Phillies issued two intentional walks and got A.J. Ellis out on a fielder's choice.
"It was chaotic for a second because those intentional walks happen quickly," Gordon said. "I didn't even have my batting gloves on when I ran to the on-deck circle."
Gordon slapped the gloves on quickly and delivered a line-drive single to right for Miami's fourth walk-off of the season and its first since June 19.
In the seventh, Stanton nearly hit a third homer. But his high drive to deep left-center was caught by left fielder Cameron Perkins, who jumped just a bit higher than center fielder Odubel Herrera to make the grab up against the wall. After making the catch, Perkins fell on top of Herrera.
Justin Bour, who has 21 homers, hit a two-run shot in the fifth to give Miami a 5-4 lead, and the Marlins (42-49) eventually snapped a three-game losing streak.
"G's homers gave us a spark," Marlins manager Don Mattingly said of Stanton. "And (Bour) gave us the lead."
Miami reliever Drew Steckenrider (1-1) earned his first big-league win, pitching a scoreless inning in the top of the 10th.
Leiter, who gave up Gordon's single, took the loss and was sent to the minors after the game.
The Marlins, who were swept over the weekend by the team with the best record in the majors, the Los Angeles Dodgers, found Philadelphia (30-61) a much more favorable matchup. The Phillies have the worst record in the majors.
Miami got off to a good start in the first inning. Gordon's pop fly fell just behind shortstop Freddy Galvis for a single. Stanton followed with his two-run shot down the left-field line. The homer was measured at 441 feet, and the exit velocity was 115 mph.
Philadelphia took a 4-2 lead in the third, forcing Miami starter Tom Koehler to throw 38 pitches in the frame. Koehler got the first two batters in the inning before walking Cesar Hernandez. Galvis followed with an opposite-field RBI double.
Miami grabbed a 5-4 lead in the fifth, scoring on Stanton's two-run homer that traveled 386 feet to left and Bour's solo shot that landed in the upper deck in right. That blast went 446 feet.
"Everyone knows about them," Hernandez said of Stanton and Bour. "They were in the Home Run Derby, and they were there because they hit so many shots."
Philadelphia tied the score 5-5 on Hernandez's sacrifice fly in the seventh. Brock Stassi drew a full-count walk and advanced on a hit-by-pitch and a sacrifice bunt before coming home.
In the end, the Phillies came up short yet again.
"Another one-run loss," Phillies manager Pete Mackanin said. "We battled."
NOTES: Marlins 3B Martin Prado was removed after four innings (right knee). He was by replaced in the lineup by Derek Dietrich. After the game, Prado was placed on the disabled list. INF Miguel Rojas was activated off the disabled list. ... Phillies 2B Cesar Hernandez (oblique) came off the disabled list and returned to the leadoff spot. In a minor league Class A rehab game Sunday, he went 1-for-1 and tied a Florida State League record with six walks. ... The Phillies placed RF Aaron Altherr (right hamstring) on the disabled list. ... Marlins RHP Brad Ziegler, who last pitched on June 20, said his back injury has been so painful that at times even breathing hurts. There's no timetable for his return. ... Marlins RHP Dan Straily (hand) is not expected to miss a start as he tossed a bullpen session on Monday. ... Tuesday's tentative pitching matchup features Marlins LHP Adam Conley against Phillies RHP Vince Velasquez. Conley will be promoted from Triple-A New Orleans and hasn't pitched in the majors since May 8. Velasquez (elbow) is coming off the disabled list and hasn't pitched since May 30.