SAN DIEGO (AP) -- Tim Lincecum was in the San Francisco Giants' clubhouse ''jumping up and down'' as pinch-hitter Xavier Nady's solo homer sailed over the fence in right-center in the ninth inning to tie a game the San Francisco Giants would win 7-5 against the San Diego Padres.
''It was a big moment for us, a big moment for him,'' Lincecum said after the Giants' stunning rally on Sunday.
After Nady tied it against Huston Street, Hunter Pence hit a two-run, go-ahead homer, and the Padres failed to answer in the bottom of the inning.
The rally got Lincecum off the hook for what would have been his 16th loss.
His final regular-start behind him, Lincecum will wait to find out how the NL West champion Giants plan to use him in the playoffs.
Coming off a loss to Arizona in which he tied his season high by allowing seven earned runs, Lincecum allowed a season-worst three home runs, including a two-run shot by Logan Forsythe and solo drives by Chase Headley and Yasmani Grandal.
Lincecum might no longer be a lock for the No. 3 spot in the playoff rotation, but manager Bruce Bochy seemed to be more pleased with Lincecum's outing that the pitcher himself was.
''I thought Timmy had good stuff today. Sure he made a couple mistakes, but it was a much better outing for him,'' Bochy said. ''Overall I thought his stuff was pretty good. He had good command and made some great pitches. He was right around the zone, for the most part today.''
Lincecum said he'll be fine going into the postseason. He knows he won't be the No. 1 guy as he was in starting all three postseason series during the Giants' run to the 2010 World Series title. Lincecum also started and won the clinching Game 5 in the World Series against Texas.
''I understand with the way things have been going this year that's not going to be the case in the postseason,'' he said. ''Obviously they're going to go with the guys who have been having great years, (Madison) Bumgarner, (Ryan) Vogelsong, (Matt) Cain. Those are going to be the guys. If I can find my way in there and get what I can when I can, that's really all that matters to me.''
A two-time NL Cy Young Award winner, Lincecum set career-worsts with a 5.18 ERA and 23 homers allowed this season.
Lincecum allowed five runs - four earned - and four hits in six innings with four strikeouts and two walks Sunday.
''I felt like I threw more quality strikes than I had in the prior outing,'' Lincecum said. ''That was great, but giving up the three home runs wasn't pleasing. But to watch us scratch back the way we did was an uplifting moment for all of us.''
With the Giants trailing 5-4, Nady drove a 1-0 pitch from Street (2-1) into the sandy play area beyond the fence in right-center. It was his second pinch homer this year and sixth of his career. Francisco Peguero beat out an infield single to shortstop, and Pence followed with a tiebreaking homer to straightaway center on a 1-1 pitch, his 24th.
On Saturday night, Nady was robbed of a home run on a leaping catch by center fielder Cameron Maybin in a 7-3 Padres win.
''Facing a guy that's been really good all year, I was just trying to get a good pitch, get on base, get something going,'' Nady said. ''The day games it seems to carry a little better.''
It was Street's first blown save in 24 chances.
''I wouldn't say the first one was necessarily a bad pitch,'' Street said of Nady's homer. ''It just caught a little more plate and he put a good swing on it. The second pitch was a bad pitch and backed up on me.''
Shane Loux (1-0) pitched one inning for the win, while Sergio Romo pitched the ninth for his 13th save in 14 chances.
The Giants had only three regular starters in their lineup as Bochy gave several players the day off. Among those sitting out was catcher Buster Posey, a strong MVP candidate who leads the race for the NL batting title with a .337 average.
Trailing 5-2, the Giants scored two runs in the eighth off relievers Luke Gregerson and Joe Hatcher before Dale Thayer came on with one out and runners on first and second. He struck out Joaquin Arias and pinch-hitter Pablo Sandoval.
Lincecum pitched well until walking Everth Cabrera with two outs in the third. Forsythe then drove a 3-2 pitch into the balcony on the third level of the Western Metal Supply Co. Building in the left-field corner for a 2-1 lead.
San Francisco tied it at 2 when Gregor Blanco drew a bases-loaded walk off Edinson Volquez with two outs in the fourth. Earlier that inning, San Diego right fielder Chris Denorfia threw out Brandon Belt trying to score on Sanchez's single.
San Diego went back ahead when Grandal drove a 2-2 pitch into the sand beyond the fence in right-center, his eighth.
Cabrera manufactured an unearned run with two outs in the fifth when he walked, stole second and third, and scored after rookie catcher Hector Sanchez's throw to third sailed into left field for an error.
Headley homered to right on Lincecum's first pitch of the sixth. It extended Headley's career highs to 31 homers and an NL-high 113 RBIs.
Volquez left the game with a cramp in his calf after falling behind 1-0 against Aubrey Huff leading off the fifth. He allowed two runs and six hits, struck out four and walked three.
''He tried to fight through it the whole game,'' manager Bud Black said. ''But as the game wore on, it ended up getting to the point where he was very uncomfortable.''
NOTES: The Giants end the season with three games at the Los Angeles Dodgers starting Monday night. Matt Cain (16-5, 2.77) is scheduled to start against Aaron Harang (10-10, 3.68). ... The Padres end with a three-game series at Milwaukee, with lefty Clayton Richard (14-13, 3.91) scheduled to start against Shaun Marcum (6-4, 3.74). ... Cabrera's four stolen bases were the most by a Padres player since Damian Jackson stole five on June 28, 1999, against Colorado. ... His 41 stolen bases are the most by a Padres player since Dave Roberts, now their first base coach, had 46 in 2006.