OAKLAND, Calif. - The NFL's worst team proved to be the best in the Bay Area for one day.
Derek Carr threw three touchdown passes and the Oakland Raiders put a major dent into San Francisco's dwindling playoff hopes with a 24-13 victory over the 49ers on Sunday.
Carr completed 22 of 28 passes for 254 yards and completely outplayed counterpart Colin Kaepernick as the Raiders (2-11) won their second straight home game surrounding last week's 52-0 loss at St. Louis.
With a second straight loss the 49ers (7-6) are in danger of missing the playoffs for the first time in coach Jim Harbaugh's four-year tenure.
San Francisco is two games out of the second wild-card spot with three games remaining after making three straight NFC title games.
A Thanksgiving night loss at home to rival Seattle prompted CEO Jed York to apologize to fans on Twitter and raise even more speculation that Harbaugh will not be back next season for the final year of his five-year contract.
A loss to one of the NFL's worst teams won't help the cause. Harbaugh even sparked the chatter where he might wind up next season when he walked out of the tunnel and straight to Raiders owner Mark Davis for a quick chat.
Harbaugh worked as an offensive assistant with the Raiders in 2002-03 under late owner Al Davis and Oakland will be looking for a full-time coach next month after firing Dennis Allen earlier this season.
Interim coach Tony Sparano is making his case to keep the job by winning two of the past three weeks, including a 24-20 victory over Kansas City on Nov. 20.
A defense that has carried San Francisco in recent weeks when the offense couldn't find a groove showed its flaws against one of the NFL's worst teams.
Carr rarely faced any pressure, giving him plenty of time to find open receivers downfield. He hit Mychal Rivera down the middle for a 27-yard gain and completed all five of his passes for 73 yards on the go-ahead drive capped by a 9-yard pass to Marcel Reece that made it 17-13.
After a three-and-out by the 49ers, Carr led the Raiders to their first consecutive TD drives of the season with a 5-yard scoring strike to Rivera, who had a career-high 109 yards receiving.
The 49ers' chance at a comeback ended when Kaepernick was sacked on third down from the Oakland 25 and Phil Dawson missed a 47-yard field goal with 5:03 to play.
Kaepernick then threw an interception to Charles Woodson with 2:36 left to seal it.
Kaepernick finished 18 for 33 for 174 yards with one touchdown, two interceptions and five sacks as San Francisco failed to score 20 points for the sixth time in seven games.
The game got off to a rough start for the 49ers. Kaepernick threw an interception to Brandian Ross on the first play from scrimmage, setting up a 57-yard field goal by Sebastian Janikowski.
The Raiders went back ahead 10-7 on a 3-yard touchdown pass to 330-pound tackle eligible Donald Penn, who bowled over Eric Reid at the goal line and then leaped into the Black Hole for a beer-doused celebration. It was Penn's third career TD catch and second against the Niners, having also caught one in 2010.
San Francisco tied it in the closing seconds on a 52-yard field goal by Dawson.