SANTA CLARA, California — Colin Kaepernick jumped into the open arms of his leaping coach and all seemed right with the San Francisco 49ers for a few hours Saturday night.
Then, in a matter of minutes, a matter of three clutch completions by Philip Rivers, the good feelings were gone.
Just when San Francisco seemed poised for a rare celebratory moment between embattled fourth-year coach Jim Harbaugh and his highly criticized quarterback, Rivers changed everything and sent the 49ers to a fourth straight defeat with a 38-35 overtime win.
After Rivers led a 21-point rally in the second half, Nick Novak kicked a 40-yard field goal nearly 5 minutes into OT to keep the Chargers' playoff hopes alive.
San Francisco (7-8) finishes the season next Sunday at home against Arizona.
"Keep fighting, get our last regular-season win. That would be our goal," Harbaugh said. "As a team we didn't finish it. Up 28-7 at one point. Guys were fighting. And San Diego did a heck of a job. Tremendous comeback."
Rivers 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.
Phil Dawson's 60-yard field goal attempt for San Francisco as regulation ended fell way short. Quinton Patton then fumbled in overtime to set up San Diego's winning drive.
Six days after the Niners' season essentially ended with playoff elimination at Seattle, Colin Kaepernick, Frank Gore and the 49ers finally got it together in all phases — for most of the night, that is.
On second down during the 49ers' first drive of overtime, Quinton Patton got loose in the open field on an end around for 20 yards and fumbled on his way down when Eric Weddle knocked the ball loose and nose tackle Sean Lissemore recovered at the San Diego 38.
The 49ers blew just their second game when leading by 21 or more at halftime. They lost 42-41 to Minnesota on Oct. 24, 1965, after leading 35-14 at halftime.
"I wouldn't call it running out of gas. We just didn't finish," said Perrish Cox, who had an interception against Rivers. "We preach about it all week long that we want to finish the season strong, but I don't know what it is."
Kaepernick ran 90 yards for a touchdown and Gore had a 52-yard touchdown run as the Niners grabbed early momentum.
Rivers threw touchdown passes of 21 and 1 yard to Antonio Gates and another to Eddie Royal, but also threw three interceptions. On one of those, Antoine Bethea ran an interception back 49 yards for his first career touchdown, and 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 combined, and New York Yankees star Alex Rodriguez was in attendance wearing the running back's red No. 21 jersey.
Gore broke four tackles on his 52-yard touchdown run in the first quarter six days after a concussion.
The 49ers became the first team since at least 1960 to rush for as many as 355 yards in a loss. Kansas City had the previous high of 352 in a 20-13 loss to the Colts on Dec. 23, 2012.
"Right now there's not much to say," Harbaugh said. "That's a tough one."
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 in the waning moments before leaving with a hamstring injury.
In one half, San Francisco topped its combined scoring total from the previous three games of 23 points. The Niners had their biggest lead since going ahead 28-3 in the third quarter of the season opener at Dallas — and their first lead by 21 points at home since a 34-3 victory against Houston on Oct. 6, 2013.
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 a head injuries.
NOTES: 49ers RT Anthony Davis returned for the first time since Nov. 9 after missing four games with a concussion. ... Cox's fifth interception moved him into a tie for third place in the NFC. ... 49ers S Bubba Ventrone and WR Brandon Lloyd suffered groin injuries.