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.