• Turning point: Geoff Blum tied the game at 4 with a two-out double off Steve Kline in the ninth after Scott Hairston homered to narrow the Giants' lead to 4-3.
• Save situation: Trevor Hoffman pitched a scoreless tenth inning to earn his fourth victory.
• Hunt for October: The Padres retained a 1 1/2-game lead in the NL wild-card race over the Phillies.
• Quotable: "It's not going to get any easier from here on out, but we're in good shape." -- Padres starter Chris Young
-- ESPN.com news services
Padres 5, Giants 4
SAN DIEGO (AP) -- One out away from having their wild-card lead trimmed to one-half game, the San Diego Padres bounced back for a big victory.
It was the third homer of the game for the Padres, who scored three runs in the last two innings. San Diego also got seven strong innings from All-Star right-hander Chris Young, who appears to have overcome side and back ailments.
"It's not going to get any easier from here on out, but we're in good shape," Young said.
"It's a great win for the team, with the heart and character of this team to come back tonight where we easily could have rolled over," the 6-foot-10 right-hander said. "But there's no quit in this team. That's what makes it fun."
The Padres won for just the fourth time in 11 games and retained a 1 1/2-game lead in the wild-card race over Philadelphia and Los Angeles.
Greene homered on the first pitch he saw from rookie Dan Giese (0-1), his 22nd.
"I'm happy it turned out like it did," Greene said. "A win's a win, but the way we did it I think is nice, especially at this point in time."
Giese said his pitch went right down the middle.
"It was way too good of a pitch and it cost us the game," he said. "I just have to make a better pitch in that spot."
The Padres are three games behind first-place Arizona in the NL West.
Trevor Hoffman (4-4) pitched a perfect inning for the win.
The Padres, who were coming off a 3-6 road trip that cost them the division lead, rallied for two runs in the ninth to force the game into extra innings.
Scott Hairston hit a leadoff homer to left off Brad Hennessey, his sixth. Josh Bard walked and was replaced by pinch-runner Brady Clark, who was sacrificed to second by pinch-hitter Craig Stansberry. That brought on Steve Kline, who got Brian Giles to fly out to the warning track in right. Needing just one out for the save, Kline gave up Geoff Blum's double down the left-field line to bring in Clark with the tying run.
Rookie center fielder Rajai Davis ended the inning with a sensational over-the-shoulder basket catch of Mike Cameron's drive to center field before slamming into the fence, spinning around and falling onto the dirt of the warning track.
"We have a lot of levelheaded guys and just a pretty workmanlike attitude throughout the team," Greene said. "Everybody continues to play the game whether they're swinging or playing defense."
With the no-decision, Young remained winless since July 19. He allowed three runs and six hits, with five strikeouts and one walk.
"We did what we did against a tough pitcher and couldn't hold on," Giants manager Bruce Bochy said. "That's been a big problem all year. It got away from us again. We've seen enough walk-off home runs and tough losses. This is an area we have to get better at."
September callup Eugenio Velez tripled for his first big league hit with two outs in the seventh, then scored on Young's wild pitch to give the Giants a 3-2 lead in the seventh.
Barry Zito pitched well for the sixth straight start, even though he's just 1-1 in that span, and hit a bloop RBI single. The left-hander held San Diego to four hits in six innings, although one of them was Kevin Kouzmanoff's two-run homer in the fourth. He struck out four and walked two.
"We had Young beat, which is great," Zito said. "Hopefully, we can just forget what happened and come out strong tomorrow."
Velez, pinch-hitting for Zito in the seventh with the score tied at 2, hit a two-out triple into the right-field corner off Young. He came in on Young's wild pitch.
Young blew through a 1-2-3 first inning on nine pitches, then quickly surrendered two runs in the second.
Barry Bonds, playing at Petco Park for the first time since tying Hank Aaron with his 755th homer on Aug. 4, opened the second with a walk and Bengie Molina singled. Bonds scored on Rich Aurilia's one-out single and Molina came in on Zito's two-out base hit.
Kouzmanoff tied the game with his shot into the sand play area beyond the fence in right-center with one out in the fourth, his 17th. Adrian Gonzalez was aboard on a leadoff single to center.
Padres broadcaster and former New York Yankees 2B Jerry Coleman turned 83 on Friday. ... "The Flying Tomato" dropped by to throw out the ceremonial first pitch. Shaun White, who won the snowboard half pipe gold medal at the Turin Olympics, threw an eephus pitch to Padres ace Jake Peavy. ... The Padres will skip RHP Justin Germano's next scheduled start, on Monday against Pittsburgh. Rookie Jack Cassel will take his place.