SAN DIEGO -- Trevor Hoffman pumped his arms in celebration and a burst of fireworks shot into the sky beyond the center-field fence.
Then everyone saw that the ball was on the ground, not in center fielder Brian Giles' glove.
Giles couldn't hold onto Randy Winn's tying, two-out triple off Hoffman in the ninth inning, and J.T. Snow hit a go-ahead single two batters later as the San Francisco Giants stunned San Diego 3-2 on Monday night and pulled within three games of the NL West-leading Padres.
"You've got your horse out there, and he pitches his butt off in that situation, it's my job to nail it down," Hoffman said. "Unfortunately, it provided a little bit of momentum for these guys going into tomorrow."
The Padres came within one out of reducing their magic number to two for clinching the division title, but Hoffman blew a save for the third time in 44 chances, ending his streak of 38 consecutive saves.
Their magic number remains four, with six games to play. The Padres fell to 77-79, the latest in a season a team has led a division with a losing record.
This is the closest the Giants have been since May 14, when they were three games behind Arizona and the Los Angeles Dodgers.
"We've been in the same boat for a while," Winn said. "We just have to keep winning."
Winn tied the game with his fourth hit, a fly ball to center field. Giles jumped and had the ball in the palm of his glove just as he hit the fence, but the impact jarred the ball loose, allowing pinch-runner Jason Ellison to score from first base. Ellison ran for Mike Matheny, who singled with one out.
"The replays showed it was close to being a homer and I just dropped it," Giles said.
Hoffman didn't blame his teammate one bit.
"That just showed the all-out effort he's given all season, on one play," Hoffman said of Giles, who's normally the right fielder but was playing center because Dave Roberts is hurt. "It's just disheartening that it slipped out of his glove at the last second when everybody thought he had it.
"The pitch was up a little bit," Hoffman said. "Make a better pitch with the changeup down, it's going to be hard to drive it that far. Randy had a great night. It seemed to keep going and keep going and keep going. One of those things. He got good wood on it."
Hoffman (1-6) then walked Omar Vizquel before allowing Snow's single to right to score Winn.
"That guy is not an easy guy to come back and get a hit off of," Snow said. "He's the best in the game."
Bonds grounded out to end the inning, finishing 0-for-5.
Peavy allowed one run, struck out five and walked one.
The Padres continued to struggle offensively, getting only three hits off Brad Hennessey and four relievers. Tyler Walker (6-4) pitched the eighth for the win and Armando Benitez worked the ninth for his 19th save in 23 chances.
Ryan Klesko, batting No. 2 for the first time this season, homered to right on a 2-1 pitch from Hennessey in the first inning. It was his 18th of the year and his second since July 16. Mark Loretta was aboard on a leadoff single.
The Padres didn't get another hit until Loretta singled with one out in the sixth.
Bonds came to bat with runners on base and two outs in the first, third and fifth innings, and Peavy retired him each time. Bonds took a called third strike in the first with a runner on first, then flied out to left in the third with the bases loaded.
After Snow hit an RBI double with two outs in the fifth, Bonds worked the count full before grounding out to second. Bonds, who hit his 700th homer off Peavy on Sept. 17, 2004, grounded out to second leading off the eighth.
Winn also scored on Snow's two-out double in the fifth.
Hennessey allowed two runs and three hits in six innings, struck out three and walked two.
- Hoffman's last blown save was April 29 in a 5-4 loss to Arizona in 15 innings.
- Moises Alou of the Giants doubled leading off the sixth to extend his hitting streak to 10 games.
- Roberts, who strained his left quadriceps Saturday night at Arizona, had an MRI and is due back Thursday or Friday. With Roberts out, manager Bruce Bochy moved everyone up one spot in the order.
- SS Khalil Greene was back in the San Diego lineup after sitting out Sunday. He fouled a ball off his left shin on Saturday night.