Derek Carr threw three touchdown passes and the Raiders bounced back from a shellacking last week by beating the 49ers 24-13 on Sunday and putting a major dent in San Francisco's dwindling playoff hopes.
The Raiders (2-11) followed their exhilarating first win of the season against Kansas City with a 52-0 loss at St. Louis before delivering their most complete performance of the season against San Francisco (7-6).
"It's great for us to come off of a (bad) week and perform the way we did today," said safety Charles Woodson, who sealed the win with a late interception.
"Being able to bounce back from the way we felt last week was big for us. To win this game, the Battle of the Bay, your crosstown rivals, it's a big win for us."
Carr completed 22 of 28 passes for 254 yards and completely outplayed counterpart Colin Kaepernick in his best performance yet in his rookie season.
With a second straight loss, the 49ers are in danger of missing the playoffs for the first time in Harbaugh's four-year tenure. San Francisco trails three teams by two games in the NFC wild-card race with three games remaining after making three straight NFC title games.
"There is no surrendering," Harbaugh said. "You look for the next thing to win at."
A Thanksgiving night loss at home to rival Seattle prompted CEO Jed York to apologize to fans on Twitter and raised even more speculation that Harbaugh will not be back next season for the final year of his five-year contract.
Harbaugh sparked more chatter about 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 before his first game in Oakland since his tenure as an assistant with the Raiders in 2002 and '03.
Raiders 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.
"We said last night in the meeting that somebody had to step up and make a couple of plays," Sparano said. "Today I felt a bunch of guys stepped up."
From Carr's big game to Mychal Rivera's 109-yard receiving day to a pair of sacks from Antonio Smith and Khalil Mack to a dominant offensive line performance that included a touchdown catch by left tackle Donald Penn, the Raiders had plenty of big performances.
"This week it was preached to us just how important this game was," Smith said. "This week more and more of us became true Raiders, knowing what the heritage is about, knowing what this game was about, how important it was to this city."
Carr rarely faced any pressure, giving him plenty of time to find open receivers downfield. He hit 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.
"They were able to go out there and take advantage of the mistakes we made," linebacker Aldon Smith said. "They just made more good plays than we did. He did a good job of getting the ball out and using his protection."
Kaepernick threw an interception on the first play from scrimmage, was sacked on San Francisco's last and wasn't much better in between. He 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 Raiders went ahead 10-7 in the second quarter on a 3-yard touchdown pass to the 330-pound Penn, who bowled over Eric Reid at the goal line and 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.
"I'm happy I'm able to live every big man's dream," Penn said.
Niners LB Ahmad Brooks had his streak of 60 straight starts snapped because he missed a meeting Tuesday. Brooks did not play at all in the game. ... Carr's 140.2 passer rating was the highest for the Raiders since Rich Gannon posted a 141.9 against the Giants in 2001.