SAN FRANCISCO -- Angel Pagan hit a tiebreaking home run leading off the eighth inning to give San Francisco a win in what might have been Tim Lincecum's final outing with the club, and the Giants beat the Los Angeles Dodgers 3-2 on Thursday night.
Pagan's fifth home run in an injury-shortened season was surrendered by losing pitcher Paco Rodriguez (3-3) and plunked off the top of an ambulance parked just beyond the fence in left field.
Lincecum struck out Yasiel Puig three times among his six Ks but missed a win against the NL West champion Dodgers. Santiago Casilla (7-2) earned the victory with a 1-2-3 eighth, while Sergio Romo pitched the ninth for his 38th save.
Lincecum is wrapping up a $40.5 million, two-year contract that paid him $22 million this season. The 29-year-old right-hander allowed two runs and three hits in seven impressive innings.
The NL Cy Young award winner in 2008 and '09 and four-time All-Star was drafted 10th overall by the Giants in 2006.
He pitched a no-hitter July 13 at San Diego and pitched the 2010 World Series clincher at Texas as the club captured its first championship since moving West in 1958. He moved to the bullpen and became an effective reliever for last season's title run.
Lincecum received a roaring ovation from the sellout crowd of 41,221 when introduced before the game -- and several more times throughout.
"I certainly hope Timmy is back with us," manager Bruce Bochy said. "Timmy has been a pleasure all my years here and I hope that continues."
Lincecum allowed two doubles to begin the fourth, then struck out the next three batters. He followed up Barry Zito's victory in his likely Giants farewell a night earlier in a 6-4 win with another emotional outing for the franchise and its supporters.
Fans held large banners reading "We love U Timmy!" and "Timmy Don't Leave" and cheered when he ran off following a fifth-inning sacrifice. Pagan had an RBI groundout in the inning, Gregor Blanco walked and Brandon Belt hit a trying double to make it 2-2.
After Adrian Gonzalez put the Dodgers ahead on a first-inning sacrifice fly, the Giants saved Lincecum a run in the second. Tim Federowicz was thrown out at home by left fielder Blanco as he tried to score on Puig's single.
Dodgers starter Edinson Volquez's winless stretch reached seven starts since he beat the Mets on Aug. 17. He didn't beat the Giants in five tries this year.
The Giants took the season series with their rivals 11-8, earning just their third series win at home in the second half in 13 tries.
San Francisco third baseman Pablo Sandoval was scratched with flu-like symptoms after he arrived at the ballpark and began throwing up, and Nick Noonan replaced him.
NOTES: A moment of silence was held before the game for Jonathan Denver, a fan stabbed to death Wednesday night a few blocks from the ballpark. ... Dodgers OF Andre Ethier isn't expected to play again during the regular season as he nurses an injured left ankle the team still hopes will improve in time for the playoffs. While he is doing baseball activities, he hurt himself running the bases Tuesday. He is expected to face live pitching in the coming days. "The biggest restriction is going to be baserunning. We'll try to wait as long as we can on that and see how it goes," manager Don Mattingly said. "Ethier, a lot of the same. That doesn't mean we're still not moving forward, though. I'm a little more encouraged today. It is showing healing. Nothing's different than we thought before. The only thing we're really worried about is the running." ... Lincecum is 9-6 with a 2.92 ERA in 23 career outings vs. L.A. ... Giants SS Brandon Crawford was awarded the "Good Guy" award by the local baseball writers chapter for his cooperation and good nature during the season.