USC's surge for Ed Orgeron had just swallowed up No. 5 Stanford's national title hopes.
Andre Heidari kicked a 47-yard field goal with 19 seconds to play, and a stalwart defense repeatedly came up big in USC's 20-17 upset of the Cardinal on Saturday night.
Cody Kessler passed for 288 yards as the revitalized Trojans (8-3, 5-2 Pac-12) earned their fifth win in six games under the irrepressible Orgeron, who replaced the fired Lane Kiffin in late September. Orgeron immediately returned fun to a dour program - and wins have followed, none bigger than this streak-snapping win over powerful Stanford.
"In our tight-knit family, there was a belief that we were going to find a way to win the game," Orgeron said. "I'm proud of our young men. This is something that they've wanted for a long time now."
USC's remarkable defensive performance included two fourth-quarter interceptions and a season-low 17 points from the Cardinal (8-2, 6-2), who followed up last week's win over Oregon by getting knocked out of the BCS title chase and maybe the Rose Bowl race as well.
Heidari nearly lost his job twice this season, and he missed an extra point in the first quarter. But the junior coolly nailed the tiebreaking field goal - and then got an unsportsmanlike conduct penalty for running the length of the field to celebrate it.
"They all said, 'We know you got this. You do it every day in practice,'" Heidari said of his teammates. "They believed in me."
Moments later, thousands of USC fans flooded the field. Stanford had won in its last three trips to the Coliseum, including a triple-overtime thriller two years ago, and its last four meetings with USC overall.
Soma Vainuku caught an early TD pass and Javorius Allen rushed for a score for USC, which played 38 straight scoreless minutes until Heidari's kick. Nelson Agholor had eight catches for 104 yards, while Marqise Lee had six catches for 83 yards - and both receivers made big plays on USC's final drive.
"I don't know if I pulled them together," Orgeron said. "I think they just came together. The leadership of this program is really coming to the forefront."
Tyler Gaffney rushed for 158 yards and two touchdowns for Stanford, which had won three straight while closing in on the chance to host the Pac-12 title game for the second straight year. Kevin Hogan went 14 of 25 for 127 yards, but the Cardinal couldn't regain the lead after trailing 17-10 at half, despite repeatedly getting close.
"I think this is the first time anyone on this team has lost to them," Gaffney said. "It's a tough thing to swallow."
Stanford tied it with Gaffney's 18-yard TD run on the first drive of the third quarter, but couldn't score on six drives in the final 23 minutes, managing just 88 yards - 75 on a single drive ending in Dion Bailey's interception.
USC's offense also struggled throughout the second half, but the Trojans' sanctions-depleted defense kept it close despite using just two substitutes for most of the night.
"They're a good team, and they got healthy at the wrong time for us," Stanford coach David Shaw said. "In the second half, we did a heck of a job defensively. We just didn't make enough plays on offensively. That's not going to win on the road in this conference."
Bailey intercepted Hogan's third-down pass at the USC 6 with about 10½ minutes to play, killing what seemed certain to be Stanford's go-ahead drive. Su'a Cravens then intercepted a tipped pass at the USC 44 with 3 minutes to play, giving another chance to the Trojans' offense.
After Lee caught a 13-yard slant pass over midfield on fourth-and-2, the Trojans reached the Stanford 21 before two straight yardage-losing plays pushed them back to the 30 - and Heidari still nailed his kick.
"This is definitely the most electrifying game I've been a part of in the four years I've been here," Bailey said.
USC hadn't beaten a ranked opponent since 2011, but the Trojans have played with ever-increasing fire and confidence for Orgeron, the longtime defensive line coach whose raw enthusiasm has worn off on the program. Orgeron wasn't thought to be a serious candidate for the Trojans' full-time job when he took over for Kiffin, but his players are pushing his name deeper into the discussion with each victory.
"Obviously there's going to be some decisions made here after we play UCLA (on Nov. 30)," Orgeron said. "That's out of my hands."
Stanford betrayed a few nerves early. The Cardinal burned two timeouts and committed an illegal-snap penalty on the game's first drive, and Ty Montgomery dropped two passes in the opening minutes.
USC's opening drive was smooth, with Lee making a tiptoe sideline catch before Vainuku came out of the backfield for a play-action 1-yard TD catch just 6:13 in.
Gaffney scored on a 35-yard run moments later when he popped out the back of a scrimmage pile and sprinted past the slumbering USC defense, but the Trojans answered with another long drive capped by Allen's 1-yard TD run and a 2-point conversion catch by Lee.
Kessler was outstanding in the pocket and on the run, completing 10 straight early passes before Heidari's first field goal put the Trojans up by 10 points early in the second quarter. Stanford added a field goal with 17 seconds left in the first half.
After Gaffney capped a 92-yard drive after halftime with his TD run up the middle, Stanford forced a fumble by Kessler at the USC 19 - but the Cardinal's field goal attempt was blocked.
Former Stanford lineman Jonathan Martin watched the game from the sideline.