Williamson kicked a 37-yard field goal as the first half expired to give Stanford a 17-14 lead. Fairbairn answered with a field goal from 31 yards on UCLA’s opening drive of the second half.
Franklin capped a 12-play, 80-yard drive with a 20-yard TD run late in the third quarter. That gave the Bruins a 24-17 advantage and put Stanford on the brink of its first home loss this season.
Instead, the Cardinal came back in impressive fashion.
After shaking off the safety, Hogan heaved the long touchdown to Terrell just over the cornerback’s head. Terrell caught the pass in the short corner and pointed to the poncho-wearing crowd.
‘‘We knew we had to remain calm and play our style,’’ Hogan said. ‘‘We kept to it. We pounded the ball, got field position, got the TD to tie it.’’
Stanford stuffed UCLA three-and-out and Terrell returned the punt 18 yards to the Bruins 43. That set up Williamson’s tiebreaking field goal.
One last UCLA drive nearly sent the game to overtime.
Tight end Joseph Fauria caught a pass over the middle on fourth-and-7 and lateraled the ball to Jordon James to finish a 17-yard completion. That helped set up Fairbairn’s field goal with 34 seconds left, and the kick never looked on target.
‘‘There’s a lot of tears and a lot of disappointment but I think they should be proud of what we accomplished,’’ first-year UCLA coach Jim Mora said.
Stanford has won five straight against the Bruins, who were going for their first conference championship since 1998.
The crowd was the smallest at 50,000-seat Stanford Stadium since the Cardinal drew 30,626 against Sacramento State on Sept. 4, 2010.
Antonio Gonzalez can be reached at: www.twitter.com/agonzalezAP