Chase Thomas intercepted a tipped pass by Matt Scott in the extra period and Stepfan Taylor ran for a 21-yard touchdown two plays later to end a week of second-guessing Nunes with a wild celebration in the Cardinal (4-1, 2-1 Pac-12) side of the north end zone.

"This is the kind of game that we needed," Stanford coach David Shaw said. "We needed to fight. We needed to battle. We needed to be into it in the fourth quarter. We needed to be down. We needed to fight back, just to test our character. We believe that we have that kind of character to be able to fight back even when we're down, but it's great when you get tested and respond to that challenge."

Maybe for nobody more than Nunes.

The offense failed to find the end zone in a 17-13 loss at Washington last week. Nunes underthrew several passes or misfired completely, and critics began to mount enough for Shaw to open his weekly news conference defending his new quarterback and boldly calling any question about a change "asinine."

Nunes followed his coach's words with his most solid game of the season. He completed 21 of 34 passes, scrambled for first downs and -- most importantly -- offset Scott's record-setting performance.

Scott completed 45 of 69 passes -- both school records -- for 491 yards and three touchdowns until Henry Anderson tipped his final pass in overtime that Thomas intercepted. Arizona (3-3, 0-3) amassed 617 total yards -- same as Stanford -- but lost for the third straight game and is still winless in conference play.

"It's depressing not to win, but that's football," Scott said.

For most of the afternoon, the Wildcats scored at will and looked more like the team that beat Oklahoma State to start 3-0 than the one that lost to Oregon and Oregon State the previous two weeks. Facing its third straight ranked opponent, Arizona's aerial attack shredded Stanford's defense in a way few have the past few seasons.

The Wildcats became the first team to eclipse 400 yards passing against the Cardinal since Oklahoma in the 2009 Sun Bowl. The Sooners threw for 418 yards in that 31-27 win over the Cardinal.

Arizona's defense couldn't hold up when it counted.

Nunes ran his second short touchdown to trim Arizona's lead to 48-41 with 6:34 remaining. The Cardinal held the Wildcats to only their third three-and-out on the next possession, and Nunes led a drive that will help ease concerns about Luck's successor.

The redshirt junior ran for 16 yards on third-and-7 from midfield, threw 17 yards to tight end Zach Ertz on fourth-and-9 from Arizona's 20 and ran for the tying touchdown with 45 seconds left in regulation.

"I made a lot of throws this week that I didn't make last week," said Nunes, adding that he worked on improving his velocity. "It's not like I can't make these throws."

This time, Stanford's offense showed some fight from the start.

Taylor, who finished with 142 yards rushing and two touchdowns, ran for 35 yards on seven carries before Nunes lofted an 11-yard touchdown pass to Ertz in the corner of the end zone to give the Cardinal a 7-0 lead on the game's first possession.

While the offense finally found its rhythm, Stanford's defense struggled to slow down Arizona's up-tempo style.

Ka'Deem Carey ran for 13 yards for the first of his three touchdowns, and John Bonano kicked a 34-yard field goal to give the Wildcats a 10-7 lead later in the second quarter.

Nunes stayed steady and sharp, finding Levine Toilolo for a 12-yard touchdown pass to put Stanford back ahead 14-10. Bonano kicked a 33-yard field goal to slice Stanford's lead to 14-13 at half.

The pace picked up even more following the break.

Scott threaded a 27-yard strike to Terrence Miller inches short of the goal line that set up Carey's short touchdown run to put Arizona in front 20-14 less than 2 minutes into the third quarter.

Although the Cardinal prefer to play grind-it-out games and control the clock, Arizona simply wouldn't let them.

The teams traded touchdowns for most of the second half until Jourdon Grandon stripped Ty Montgomery after a 16-yard catch early in the fourth quarter. Arizona recovered and took over at Stanford's 45.

Scott quickly led the offense down field and hooked up with Miller for a 10-yard completion that gave the Wildcats a 48-34 lead -- the biggest either side had all afternoon. Scott nearly set the school passing record set by Willie Tuitama, who threw for a school-record 510 yards in a 48-41 win over Washington on Oct. 27, 2007.

Rodriguez opted to run the clock out with 45 seconds remaining from Arizona's own 19 with two timeouts and play for overtime, saying he "didn't want to make a mistake down there."

"Matt is a stud. He threw the ball well. We just needed to make one more play," Rodriguez said. "There's nothing to be ashamed of."

The Cardinal again showed its ability to bounce back after defeat.

Stanford has won after its last seven losses. The last time the Cardinal dropped consecutive games came in 2009, when it lost to Oregon State on Oct. 10 and Arizona on Oct. 17.

"It's huge," Thomas said. "To show that we can face adversity, overcome it and have that 16-round knockout fight really shows that this team's a high-character team that never gives up and has a never-quit mentality."