Santa Clara, CA (SportsNetwork.com) - Philip Rivers' arm got the San Diego Chargers to overtime.
Eric Weddle's arm helped them win the game once they got there.
Rivers led two touchdown drives in the final nine minutes of regulation and Weddle forced a fumble that led to Nick Novak's winning 40-yard field goal in overtime, as the Chargers rallied to beat the San Francisco 49ers 38-35 in a thriller on Saturday night.
San Diego trailed by 21 points at halftime and by 14 in the fourth quarter before Rivers' touchdown passes to Antonio Gates and Malcom Floyd, the last one coming with 29 seconds left on the clock.
Weddle, the veteran safety, stripped wide receiver Quinton Patton on a 20-yard end-around -- just San Francisco's second play in overtime -- and Novak split the uprights for the win.
"An unbelievable finish," said Chargers coach Mike McCoy. "We had about as bad a first half as we can possible play."
Rivers passed for 356 yards with four touchdowns and San Diego (9-6) overcame his three interceptions, including two that led to 14 San Francisco points in the first half.
The playoff-hopeful Chargers stopped a two-game losing streak, winning without injured stars Ryan Mathews and Keenan Allen.
"Shoot," said Rivers, "we just got going. We found a little rhythm and finished it off."
Despite 355 rushing yards, the 49ers (7-8) suffered their fourth straight loss, guaranteeing them their first non-winning season under Jim Harbaugh.
"As a team we didn't finish it," said Harbaugh. "The guys fought but San Diego did a heck of a job. It was a tremendous comeback."
Colin Kaepernick had the second-longest touchdown run by a quarterback in NFL history, a 90-yarder late in the third quarter that restored San Francisco's 14-point lead.
It came two just two plays after his fumble was recovered in the end zone by Corey Liuget for a San Diego touchdown.
Kaepernick passed for 114 yards with a touchdown to Bruce Ellington and rushed for 151 on seven carries. Frank Gore added 158 yards on 26 rushes, including a 52-yard touchdown run less than two minutes into the game.
"We did a lot of things well. We just had three turnovers. That's the difference in the game," said Kaepernick. "We have a fumble on the goal line, a fumble that ends in a touchdown and a fumble in overtime. That's at least a 14-point swing."
Rivers has 252 career touchdowns passes, moving within two of Hall of Famer Dan Fouts' franchise record. No. 250 was a 1-yard throw to Gates early in the third quarter.
San Francisco's Vernon Davis had a 63-yard touchdown catch called back after that because of two penalties, and things got worse for the 49ers when Ricardo Mathews hit Kaepernick, forcing the fumble that Liuget recovered to get the Chargers within 28-21.
But the nimble Niners quarterback slipped out of a closing pocket two plays after the kickoff and juked Weddle down the field on his 90-yard touchdown run -- second in NFL history only to Terrelle Pryor's 93-yard score for Oakland against Pittsburgh on Oct. 27, 2013.
The 49ers didn't capitalize on Rivers' third interception, punting early in the fourth quarter, and the Chargers later pulled within 35-28 on Gates' second touchdown catch of the game, a 21-yarder with 5:15 remaining.
Gates' 99th career touchdown reception tied Hall of Famer Don Hutson for ninth place all-time.
Eddie Royal made a diving 17-yard catch on fourth down with a defender on his back, keeping San Diego's game-tying drive alive. Rookie Dontrelle Inman did the same with a 17-yard grab on 4th-and-10, leading to Rivers' 11-yard throw to Floyd in between two defenders in the end zone.
Kaepernick had a 20-yard scramble on San Francisco's final drive in regulation but Phil Dawson was way short and right on a 60-yard field goal attempt.
The 49ers end the season at home next Sunday against Arizona in what could be their last game under Harbaugh, who likely won't remain their coach after this season.
Harbaugh, who is 43-19 with the 49ers, has reportedly been offered the head coaching job at Michigan, his alma mater.
"There's not much to say except keep fighting and get our last regular-season win," the coach said.
Gore's bruising 52-yard effort 1:48 into the game was his longest touchdown run in more than five years.
The 49ers were close to scoring again on their second possession, but fullback Bruce Miller fumbled at the San Diego 2-yard line when safety Marcus Gilchrist got his helmet on the ball.
The Chargers gave it back when Rivers was intercepted by Perrish Cox at the San Francisco 33 and the 49ers scored on Kaepernick's 8-yard touchdown pass to a wide-open Ellington early in the second quarter.
On the ensuing Chargers possession, Antoine Bethea stepped in front of Rivers' pass over the middle and took the interception back 49 yards without being touched to make it 21-0.
Rivers floated a 15-yard touchdown pass to Royal to get the Chargers on the board, but the 49ers marched back down the field to restore their 21-point lead on Ellington's 1-yard run with six seconds remaining in the first half.
Royal had 10 catches for 94 yards and Gates added seven for 92. Inman made his first seven NFL receptions for 79 yards ... The banged-up Chargers were without running back Mathews (ankle) for the second straight game because of an ankle injury. Leading receiver Allen sat because of a broken collarbone and injured ankle ... San Diego finishes the regular season next Sunday in Kansas City ... The Chargers have won four in a row against the 49ers dating back to 2002 and lead the regular-season series 7-6 ...49ers safety Eric Reid left the game with a concussion.