TUCSON, Ariz. -- Nic Grigsby raced 57 yards for a touchdown with 2:57 to go, and Arizona rallied from a 15-point deficit to defeat Stanford 43-38 on Saturday night.
The Wildcats ended a wild night in the desert by repelling the Cardinal on fourth-and-10 at Arizona's 17, with cornerback Trevin Wade batting down a pass intended for Chris Owusu in the end zone.
Nick Foles threw for 415 yards and three touchdowns as the Wildcats (4-2, 2-1 Pac-10) overcame a big night by the Stanford offense. Cardinal tailback Toby Gerhart ran for 123 yards and two touchdowns, and Andrew Luck threw for 423 yards and three scores. He also had an interception.
The Cardinal (4-3, 3-2) had their four-game winning streak in Tucson snapped.
The game turned when Stanford, leading 38-36, went for it on fourth-and-1 at Arizona's 8 with 5:27 to go.
The natural call would have been a handoff to the hard-charging Gerhart, but he limped off before the play. Luck found Owusu in the flat, but Owusu dropped the ball.
Given new life, the Wildcats rallied on Grigsby's dramatic run on third-and-17 from the Arizona 43-yard line.
With Stanford in pass defense, the shifty Grigsby took a delayed handoff, danced through traffic at the line and then broke down the left sideline, outrunning the secondary to the end zone as the Arizona Stadium crowd of 53,479 erupted.
The Cardinal responded in a heartbeat.
Luck kept the drive alive by scrambling for a first down on fourth-and-5 in his own territory, then hit Doug Baldwin for 36 yards to the Wildcats' 17 with 50 seconds remaining.
But that's where the drive died, as Luck missed on his last three passes, including one that glanced off Ryan Whalen's fingertips in the end zone.
The two teams combined for more than 1,100 yards of offense in a game that evoked memories of old-style, run-and-gun Pac-10 football.
Arizona and Stanford haven't both finished in the upper division of the Pac-10 since 1995. But both teams entered this game with dreams of contending for the title in the wide-open conference race.
Leading 31-29 midway through the third quarter, the Cardinal seemingly took command with a 6-play, 86-yard march. The big play was a 47-yard strike down the middle from Luck to Owusu, setting the Cardinal up at Arizona's 2.
Gerhart barged over on the next play to give the Cardinal a 38-29 lead.
Arizona's Greg Nwoko burst up the middle for a 43-yard touchdown to trim the deficit to 38-36 with 10:06 to go, setting the stage for the memorable finish.
The first half was just as wild as the second, with the teams combining for 48 points and 547 yards in the first 30 minutes.
Arizona jumped ahead 7-0 less than three minutes into the game when cornerback Robert Golden picked off a Luck pass and raced 79 yards for a touchdown.
Luck answered with a 30-yard scoring strike to a wide-open Jim Dray to tie it at 7-7.
Foles hit David Douglas for a 43-yard touchdown, and Arizona led 13-7 after Stanford blocked Alex Zendejas' extra point try.
Stanford reeled off 21 unanswered points in less than 13 minutes. Gerhart scored on a 2-yard run, and then Luck threw touchdown passes to Whalen and Owusu to put the Cardinal ahead 28-13.
The Wildcats rallied late in the half on a masterful drive by Foles, who led Arizona 89 yards in 12 plays and 2:36. Foles hit Terrell Turner on an 11-yard slant with 18 seconds remaining to cut the lead to 28-20 at halftime.
Nike Men's Arizona Wildcats Navy/Cardinal Team Issue Performance PoloShop
Arizona linebacker Scooby Wright's left knee injury is not season-ending, according to an MRI Wright had after Thursday night's opening win over UTSA, sources told ESPN's Brett McMurphy.
Syracuse starting quarterback Terrel Hunt has a significant injury to his right Achilles, head coach Scott Shafer said after the Orange's season-opening 47-0 rout of Rhode Island.
The Mountain West told ESPN's Brett McMurphy that officials correctly ruled the final play that kept Colorado from getting a potential game-tying touchdown against Hawaii before time expired.
ESPN 300 running back Elijah Holyfield, the son of former heavyweight boxing champion Evander Holyfield, has decided to stay home and attend Georgia, he announced Friday.
Miami reserve linebacker Al-Quadin Muhammad has been suspended for the season opener against Bethune-Cookman on Saturday for a violation of team rules, a source confirmed to ESPN.com
All-American defensive end Shawn Oakman and safety Orion Stewart have been suspended for Baylor's season opener Friday against SMU for a violation of team rules, a school spokesman told ESPN.com.