San Francisco (66-54) got on the board first when Joaquin Arias smacked a solo homer -- just his second of the season in 80 games -- off San Diego starter Eric Stults.
The Padres (52-70) came back with with a run of their own in the bottom of the inning, as Giants starter Barry Zito walked Carlos Quentin and Yasmani Grandal to lead off the inning and then yielded a single to Jesus Guzman to set up a Cameron Maybin RBI grounder.
Zito blinked yet again in the third, when the red-hot Chase Headley clubbed his 20th homer of the season and eighth this month with two men on to give the Padres a 4-1 lead. Last week's National League Player of the Week, Headley is hitting .328 (21-for-64) in August with those eight homers.
"I just got a slider out over the plate," Headley said. "Sometimes you get a pitch like that to hit and you overswing, but I was fortunate to take my swing at it and hit it out."
But the lead Headley handed his team wouldn't last long, as the Giants put together a four-run, four-hit fifth inning. That rally included two sacrifice flies, one each from Marco Scutaro and Hunter Pence, as well as an RBI single from Arias, who led the Giants with three RBIs.
That inning left Stults on the hook for the loss, as when he left the game after giving up five runs in six innings, the Padres trailed, 5-4. They wouldn't for long, though, as Quentin launched a game-tying solo homer deep into the left-field stands to bring San Diego right back in the bottom of the inning.
"The fifth inning didn't have the results I wanted to," Stults said. "I put a couple pitches right where I wanted to, and they were able to barrel it up. ... You can't make them hit it at people sometimes, but overall, I was able to keep us in the game."
So the game went to the seventh tied, though the Giants untied it rather quickly when they put together a two-run inning off Brad Brach that included RBIs from Arias and Buster Posey. That duo paced the Giants' attack with three hits apiece.
After the Giants tacked on another run off Brad Boxberger in the top of the ninth, the Padres made two quick outs off Jeremy Affeldt. But a two-out walk to Yonder Alonso gave them the opening they needed.
Despite looking rather uncomfortable after an Affeldt curveball buckled his knees on the first pitch of his at-bat, Alexi Amarista recovered aptly and singled to drive home Alonso. Chris Denorfia then hit a single of his own to bring Amarista home and the Padres within one in an improbable two-out rally.
Righty Clay Hensley came in to relieve Affedlt, and the Padres sent up pinch-hitter Mark Kotsay, who was 0-for-7 off Hensley in his career, to try to complete the comeback. In a day full of back-and-forth battles, Hensley won the final one, getting Kotsay to strike out swinging to end the threat and the game and send Brach (1-3) and the Padres to a hard-fought loss.
The defeat gave the Padres their first five-game losing streak since a six-gamer from May 25-30. When that streak ended, the Padres were 17-35 and playing a very different brand of baseball than the team that was 18-12 since the All-Star break prior to this current losing streak.
Yet despite results reminiscent of those early-season struggles, the Padres do not see this stretch as a relapse by any means.
"It feels different," Headley said. "I think we're still playing good baseball. Obviously Atlanta was playing really, really well ... and [the Giants are] a really good team, but we have to find a way to break through. It's different than it was at the beginning of the season; we're playing a lot better."