PHILADELPHIA -- For Cole Hamels, Wednesday's game was a bit of poetic justice.
For the Seattle Mariners, it was a head-scratcher.
Hamels (7-6), a red-hot starter and common victim of poor run support, was off his game and lasted just five innings. However, he left the park with a win after the last-place Philadelphia Phillies beat the playoff-contending Mariners 4-3 in a sloppy game at Citizens Bank Park.
"He's pitched outstanding. He was due for a win like this with not his best stuff and his teammates picking him up," Phillies manager Ryne Sandberg said of Hamels. "He's on a long roll of good games and some of them without the run support. He was due for one today."
Hamels entered with the majors' third-best ERA since June 1 (1.60) but just five wins in 15 starts during that span. On Wednesday, he allowed three runs and nine hits in his shortest outing since July 2, but thanks to a surprisingly unsound performance from Seattle, Hamels was victorious.
"To be honest with you, we've been pretty damn good," Mariners manager Lloyd McClendon said. "That's the first one we've had all year like that. A lot of things just didn't go right. Knock on wood, it's OK.
"Some days, the stars just aren't lined up for you. It's the way it goes."
In a game that featured three wild pitches, two errors and a passed ball, Philadelphia (56-71) scored three unearned runs in the bottom of the fourth inning to erase a 3-1 deficit and eventually win just its fourth series since June 19.
Seattle starter James Paxton (3-1) airmailed first base on a liner that ricocheted off his leg with a man on first and no outs in the inning. The two-base error put runners at second and third before a passed ball led to the Phillies' first run of the inning.
Paxton mistakenly crossed up catcher Jesus Sucre on the play.
"I just missed that one," Paxton said. "I (misread) his fingers."
After center fielder Ben Revere tied the score with an RBI groundout, shortstop Jimmy Rollins singled, moved to second on a wild pitch and scored on second baseman Chase Utley's soft-served single to right, giving Philadelphia a 4-3 advantage it wouldn't relinquish.
"I think the team definitely played really well with getting the runs in when we needed to. I think the defense we had was outstanding," Hamels said. "So it's just some of those moments where you need everyone behind you and everybody was able to deliver."
After taking two of three games from American League wild-card competitor Detroit, the Mariners (68-58) lost for just the fifth time in the last 17 games. They entered Wednesday a season-high-tying 11 games above .500 and tied with the Tigers for the second wild-card spot.
"We know where we're at in the race," Seattle right fielder Logan Morrison said. "Good teams don't do that, playoff teams don't do that, so we've got to come out and be better, and we have been and we will"
Paxton suffered his first major league loss after working four innings. The left-hander, who yielded four runs (one earned), was 6-0 with a 1.88 ERA in his first nine career starts dating to last season.
"They were finding holes with ground balls, a couple bloopers in there, but that's baseball," Paxton said. "I need to battle and I did. It came down to me making that throw to first base. That can't happen."
The Phillies' bullpen pitched four scoreless innings to seal the win with nine of the final 12 outs coming via strikeout. Jake Diekman went two innings and struck out four, Ken Giles punched out two in the eighth and closer Jonathan Papelbon saved his 30th game with two strikeouts.
"They're definitely developing into top-caliber guys, which is going to set up the bullpen for the future," Hamels said. "You have to like what you see because they come in and any challenge that they're facing, they go right after it."
Philadelphia didn't play a clean game, either, but got away with it.
With a runner on first and no outs in the top of the fourth inning, Phillies third baseman Andres Blanco made a diving stop on a hard-hit grounder to his left by left fielder Chris Denorfia. The ball popped out of Blanco's glove and he fired to second for a potential forceout but threw errantly into right field, leading to a first-and-third, no-out jam. Morrison then doubled to left-center to give the Mariners a 2-1 lead.
Morrison then eventually came around to score with two outs on a wild pitch by Hamels.
Both runs were earned, but could have been prevented.
But with the Phillies' slipshod play came some from the Mariners, and that was the difference.
"I feel like we gave the game away," Morrison said. "We had opportunities early, errors, passed ball, wild pitches, whatever they were. Gave them four runs, I felt like. They've got a good back end of the bullpen and they did their job today."