SAN DIEGO (AP) -- The San Diego Padres are happy to get wins no matter how they happen.
The NL West's last-place team came away with an 8-7 victory in 12 innings over San Francisco when Giants second baseman Marco Scutaro's error allowed Yonder Alonso to score. Alonso had doubled and then advanced to third on a single by Jedd Gyorko.
After losing five straight, the Padres have won three in a row.
Players said it was encouraging to get so many involved in a 14-hit night that helped erase an early five-run deficit, and reassuring that the bullpen pitched seven scoreless innings to turn the tide.
Padres manager Bud Black cited an extra source of inspiration: a rally squirrel.
''We're down five runs and we score six after the squirrel showed up in the middle of the fourth,'' Black said in jest, referring to a promotional event where a squirrel mascot raced a fan between innings. ''I've seen a rally monkey work (in the 2002 postseason) when I was pitching coach in Anaheim. The squirrel won the race, and we put up six.''
San Diego trailed 5-0 before rallying for six runs in the fourth inning, their biggest single-inning output of the season. Alonso and Chris Denorfia each had two-run doubles to chase Barry Zito.
''It was nice to get Zito out early and get into their bullpen,'' Hundley said. ''It was even better that we came back from five runs down. We fought our way back into this game, and most everyone played a part in it. I love that we never gave up and we found a way to win the ball game.''
Zito gave up six runs - five unearned - in 3 2-3 innings at Petco Park, a place where he struggles. Zito hasn't made it through the fifth inning in five of his last seven starts in San Diego, and hasn't won there since Aug. 2, 2008.
''He just couldn't get the last out in the fourth,'' Giants manager Bruce Bochy said. ''That's what killed us. He was cruising until then.''
The Giants responded with Hunter Pence's two-run double in the fifth, which gave San Francisco a 7-6 advantage before the Padres tied it in the seventh inning on Kyle Blanks' single that scored Chase Headley.
The deadlock held nearly five innings, until Scutaro's misplay decided the game.
''It was a tough hop, an in-between hop,'' Giants manager Bruce Bochy said. ''It was a tough play on his part. If he comes up with it, we're out of the inning.''
The loss was fourth straight for the Giants (13-11), and their third extra-inning defeat in four games.
Sergio Romo (1-2) took the loss.
Joe Thatcher (1-0) pitched the 12th inning giving up two hits for the win.
The victory was big for the Padres (8-15), who earned just their fourth home win of the season
''It's definitely nice,'' said Alonso, who was 3 for 5 with three doubles and two RBIs. ''Wins like this give you life. They give you an opportunity to build some momentum and create a string of positive results.''
Blanks had a solid night, going 3 for 6 with an RBI.
The Giants were paced by Brandon Crawford, who hit a three run homer in the second inning, and Hunter Pence, who had a triple and two RBI.
NOTES: Giants LHP Jeremy Affeldt, on the 15-day disabled list with a strained oblique, drew positive reviews from a Saturday bullpen session at Petco Park. Bochy said Affeldt is scheduled to throw another bullpen session on Monday. Based on that performance, Affeldt will throw against live hitters or be reactivated. He is eligible to come off the DL on Tuesday. . Bochy said he is not implementing a platoon at first base. Brandon Belt, who has struggled against left-handers, started against Padres LHP Eric Stults. . Padres RHP Andrew Cashner will remain in the starting rotation after consecutive quality performances. Cashner, who started the season in the bullpen, remains on a pitch-count loosened with every start.