SAN FRANCISCO -- Angel Pagan belted reliever Paco Rodriguez's third pitch for a home run leading off the eighth inning, breaking a 2-2 tie and sending the San Francisco Giants to a 3-2 win over the Los Angeles Dodgers in what might have been Tim Lincecum's final game as a Giant on Thursday night.
One inning after Lincecum, a pending free agent, left a 2-2 tie to a standing ovation, Pagan hit a line drive down the left-field line that appeared destined for a double when it hit the top of the wall. But the ball's momentum carried it into the runway near the left-field bleachers, giving Pagan his fifth homer of the season.
Rodriguez (3-3) was pitching for the first time in eight days. He had just taken over for Chris Withrow, who faced only six batters in preserving a 2-2 tie in the sixth and seventh innings after replacing Dodgers starter Edinson Volquez.
The loss almost assuredly secured the No. 3 National League playoff position for the Dodgers (91-68), who trail the St. Louis Cardinals (94-65) and Atlanta Braves (94-65) by three games apiece with just three games to go in the regular season.
Unless the Dodgers sweep their three-game series against the Colorado Rockies this weekend and either the Cardinals or Braves are swept in their remaining games, Los Angeles will enter the National League Divisional Series as the third seed and open on the road against the runner-up in the race for the league's best record.
In clinching their first winning month since May, the Giants rallied from a 2-0 deficit as Lincecum settled down after a shaky start.
The seven-year Giant completed seven innings, allowing just the two early runs on eight hits. He walked two and struck out six.
The 2008 and 2009 Cy Young Award winner will become a free agent at season's end. He finished 2013 with a 10-14 record and 4.37 ERA, both far cries from his 89-70 and 3.46 ERA marks over his first seven seasons with the Giants.
Sensing he might have thrown his final pitch of the season, the sellout crowd gave Lincecum a standing ovation as he walked to the dugout after retiring the Dodgers in order in the top of the seventh.
The 41,221 were right. Johnny Monell pinch-hit for Lincecum, and when the Giants didn't score in the inning, the pending free agent -- like Dodgers starter Volquez -- finished with a no-decision.
The no-decision did keep Lincecum from potentially adding to an unwanted distinction. He leads all major league pitchers in losses in the past two seasons with 29.
The six strikeouts increased Lincecum's career total to 1,510. He joins Tom Seaver and Bert Blyleven as the only pitchers since 1893 to record at least 1,500 strikeouts in their first seven big-league seasons.
Santiago Casilla (7-2), who pitched a scoreless top of the eighth, got the win for the Giants. Sergio Romo worked a 1-2-3 ninth to close out an 11-8 season-series win for the Giants and record his 38th save.
Volquez, seeking his first win in five starts for the Dodgers, left for a pinch-hitter in the top of the sixth of the 2-2 tie. He gave up two runs on four hits and three walks. He struck out four.
The Dodgers got only one hit -- Mark Ellis's second double of the game -- over the final five innings.
The Dodgers scored single runs off Lincecum in the first and fourth innings to take a 2-0 lead, capitalizing on extra-base hits on both occasions. Carl Crawford scored after a one-out triple in the first. Juan Uribe and Mark Ellis teamed to produce the fourth-inning run with back-to-back doubles.
Lincecum played a role in a two-run Giants fifth that tied the game. After Nick Noonan singled and advanced to second on a Volquez wild pitch, Lincecum sacrificed the Noonan to third, from where Noonan scored on Pagan's infield out.
Two batters later, Brandon Belt's two-out double into the right-field corner brought home Gregor Blanco, who had walked, with the tying run.
NOTES: Jonathan Denver, a 24-year-old from Fort Bragg, Calif., was stabbed to death four blocks from AT&T Park about two hours after Wednesday's Dodgers-Giants game. San Francisco police concluded the incident was sparked by the teams' heated rivalry, and reported two arrests had been made Thursday. The clubs observed a moment of silence in Denver's honor shortly before the game. ... Giants 3B Pablo Sandoval was a late scratch because of what was labeled flulike symptoms. Sandoval had a two-run home run in Wednesday's 6-4 win over the Dodgers in the middle game of the series. ... An MRI and CT scan performed in Los Angeles on OF Andre Ethier's lower left leg revealed no stress fracture, but showed he has not fully recovered from shin splints. Ethier is unlikely to play the rest of the regular season, and his spot on the Dodgers' postseason roster is now in question. ... The Dodgers announced before the game that LHP Clayton Kershaw has been selected as the winner of the Roy Campanella Award, given annually to the club's most inspirational player. The award, voted upon by Dodgers players and coaches, will be presented to Kershaw before Saturday's home game against the Colorado Rockies.