SANTA CLARA, Calif. -- Philip Rivers looked at the 21-point deficit on the scoreboard at halftime and even he wondered whether the San Diego Chargers had it in them to come back. The season depended on it, so Rivers took charge.
He prevailed through a balky back and a sore chest to keep San Diego's slim playoff chances alive, rallying his team to tie it in the final minute and setting up Nick Novak's 40-yard field goal nearly 5 minutes into overtime in a 38-35 victory over the San Francisco 49ers on Saturday night.
"Obviously, an unbelievable finish," coach Mike McCoy said. "We had about as bad a first half as we could possibly play. ... You saw a lot of emotion on the sideline throughout that second half -- the excitement, the energy, the way we play football."
He completed his fourth touchdown pass of the day with a tying 11-yard TD pass to Malcom Floyd with 29 seconds left in regulation after completing a pair of fourth-and-longs as the Chargers (9-6) forced overtime.
"What a comeback. It's one of the greatest I've been a part of, and it keeps us alive," Novak said. "To kick the game winner, do-or-die kick ... loved being in that moment."
He shined with the season on the line. The Chargers came in needing to win out and get some help after beginning the week tied with Kansas City and Buffalo, one game out of the final wild-card berth. San Diego ends the season at Kansas City next Sunday.
Rivers converted fourth-and-8 and fourth-and-10 on the key final San Diego drive of the fourth quarter.
"We just got going and fell into a rhythm," Rivers said. "At halftime, we didn't know if we could come all the way back, but we were going to fight. That's who we are."
The 49ers blew just their second game when leading by 21 or more at halftime and lost their fourth straight game under embattled coach Jim Harbaugh. They lost 42-41 to Minnesota on Oct. 24, 1965, after leading 35-14 at halftime.
"Right now there's not much to say," Harbaugh said. "That's a tough one."
Rivers threw touchdown passes of 21 and 1 yard to Gates and another to Royal, but also was hurt by three interceptions. On one of those, Antoine Bethea had a 49-yard return for his first career touchdown. A defense minus recently released starting lineman Ray McDonald never let Rivers find a rhythm.
The 31-year-old Gore finished with 158 yards and he needs 38 yards in the final game next weekend against Arizona for a fourth consecutive 1,000-yard season and eighth in his 10 NFL seasons. His scoring run was his longest since a 64-yarder on Nov. 1, 2009, at Indianapolis. It also was the longest TD run allowed by San Diego since 2010 before Kaepernick topped it.
Gore had more yards in this game than in his previous four games combined, and New York Yankees star Alex Rodriguez was in attendance wearing the running back's red No. 21 jersey.
Rookie Bruce Ellington caught an 8-yard touchdown pass from Kaepernick early in the second quarter that put the Niners up 21-0, then ran for a 1-yard score late in the half before leaving with a hamstring injury.
Rivers, 33-for-54 for 356 yards, sat out Wednesday's practice with chest and back injuries.
"We've got the best quarterback in the league," Floyd said. "We had faith in us."
Harbaugh, who is facing a constant swirl of speculation about his future -- like a report alma mater Michigan has made him a six-year offer to coach the Wolverines -- has said there's still plenty to play for, like a winning season despite the disappointment following three straight trips to the NFC championship game.
Four players sustained concussions or head injuries -- 49ers safety Eric Reid and San Diego cornerback Shareece Wright with concussions and San Francisco cornerback Leon McFadden and linebacker Aldon being evaluated for head injuries.
San Diego CB Steve Williams suffered a knee injury and C Chris Watt hurt an ankle. ... 49ers RT Anthony Davis returned for the first time since Nov. 9 after missing four games with a concussion. ... 49ers CB Perrish Cox made his fifth interception, moving him into a tie for third place in the NFC. ... 49ers S Bubba Ventrone and WR Brandon Lloyd suffered groin injuries.