Andrew Luck and the fourth-ranked Stanford ranked USC's best punch and outlasted their Pac-12 48, in an epic three-overtime cliffhanger.
A defensive first half turned into an offensive showcase featuring two of the best quarterbacks in the country.
Luck, the Heisman Trophy front-runner, threw an interception for a touchdown late in the fourth quarter but rallied the Cardinal (8-0, 6-0 Pac-12) for the tying score in the final minute of regulation.
Matt Barkley nearly led the Trojans into field goal range, but time ran out and the teams traded touchdowns in the first two overtimes.
Stepfan Taylor's five-yard touchdown run on the first possession of the third OT, followed by Luck's two-point conversion pass to Coby Fleener, put the onus back on USC (6-2, 3-2).
Curtis McNeal, who ran for two touchdowns to give the Trojans a 10-point lead in the third quarter, fumbled the ball into the end zone on USC's second snap, and the Cardinal recovered to extend the nation's longest winning streak to 16.
Luck ended with 330 yards and three touchdowns on 29-of-40 throws and added 36 yards and a score on the ground.
But the senior threw an ill-advised pass late in the fourth quarter, as Nickell Robey collected the errant throw and returned it 33 yards untouched for a 34-27 lead with 3:08 remaining.
Undaunted, Stanford answered with a 10-play, 76-yard drive, which was extended on a personal foul penalty following a third-down incompletion. Taylor went in from two yards out with 38 seconds remaining to tie it.
USC quickly reached the opposing 40-yard line with nine seconds showing. Barkley then hit Robert Woods on a quick slant, and the star receiver, despite still having two timeouts left, tried to get out of bounds before time expired. He eventually reached the sideline at the 33, but zeroes showed on the scoreboard, sending the game to OT.
Jeremy Stewart ended a run-only Stanford drive with a one-yard plunge, and Woods caught a 15-yard fade in the right corner of the end zone to extend the thriller.
Randall Telfer's 12-yard TD reception was countered by Levine Toilolo's 11- yard hookup with Luck, who placed the ball on the receiver's outside shoulder along the left sideline in the end zone.
Taylor scored three plays into Stanford's third touch of the extra session, and after Marqise Lee stepped out of bounds at the four, McNeal spoiled his 145-yard rushing effort by fumbling the game away.
Most of Stanford's 198 yards in the first half came on a game-opening 10-play, 83-yard march. Luck completed all five of his attempts for 74 yards, his last a 10-yard touchdown to Tyler Gaffney.
Andre Heidari booted a 22-yard field goal later in the opening quarter, and he and Eric Whitaker traded successful makes -- 50 and 33 yards, respectively -- in the second.
McNeal rattled off touchdown runs of 61 and 25 yards on handoffs to the left side early in the third, putting Stanford behind for the first time all season.
Luck countered with a five-yard TD pass to Ryan Hewitt and a two-yard scramble to paydirt for a 24-20 edge heading to the final quarter.
Barkley, who had 284 yards and an interception on 28-of-45 attempts, threw the first of his three touchdowns to Lee, a 28-yarder with 13:04 remaining.
Whitaker's 29-yard field goal with 5:10 showing set the stage for the memorable finish.
Stanford's winning streak is a school record...The Cardinal had won 10 straight by 25 points or more...The Cardinal have won four of their last five against USC...Luck was sacked twice, doubling his season total...Taylor ran for 99 yards on 23 carries...Griff Whalen led Stanford with 102 yards on six receptions...Woods had a team-high nine receptions for 89 yards...USC starting running back Marc Tyler suffered an injury on USC's first offensive snap.