This browser does not support the Video element.
DALLAS (AP) -- Baker Mayfield threw 59 yards to Mark Andrews for the go-ahead touchdown in the fourth quarter after Oklahoma had blown a 20-point lead, and the 12th-ranked Sooners held on to beat Texas 29-24 on Saturday.
Mayfield's second TD throw of more than 50 yards came 68 seconds after freshman quarterback Sam Ehlinger ran 8 yards to give the Longhorns their first lead after trailing 20-0 in the second quarter.
The win kept the College Football Playoff hopes alive for the Sooners (5-1, 2-1 Big 12) a week after a stunning home loss to Iowa State when they were ranked third with a nation-leading 14-game winning streak.
Lincoln Riley, the youngest FBS head coach at 34, topped Tom Herman in the first Texas-OU matchup since 1947 with both coaches leading their teams for the first time. Bud Wilkinson, who led the Sooners to three national titles, was the losing coach in that game.
Ehlinger, the second straight freshman to start against Oklahoma for Texas (3-3, 2-1), had to be replaced by last year's starter, Shane Buechele, on the drive after the Sooners went back in front.
After going to the pop-up medical tent when he went down hard on his right shoulder and helmet on the Texas sideline, Ehlinger returned five plays later.
The series ended on downs, and the Sooners had to stop the Longhorns once more on a drive that started at the Texas 4 with 49 seconds left.
It finally ended on a desperation lateral play at the Texas 48, clinching a tense OU win that looked early to be a blowout but instead was the fourth straight in the series decided by seven points or fewer.
Mayfield, who grew up in Austin often wearing Sooner gear, beat his hometown team for the second straight year. He came back after leaving at the end of a second-half series appearing to favor his right arm after a hit on the ground, finishing with 302 yards passing and two touchdowns.
Mayfield opened the scoring with a 54-yard pass to Jeff Badet, who was waiting in the end zone to make the catch as trailing safety Kris Boyd waved fruitlessly at the ball. Andrews ran free down the sideline, and Mayfield hit him in stride with 6:53 remaining.
Ehlinger, a huge Texas fan while also growing up in Austin, threw for 278 yards and a touchdown and ran for a game-high 106 yards.
Oklahoma's Trey Sermon had 96 yards rushing and a 42-yard pass on a trick play that set up one of Austin Seibert's three field goals.
THE TAKEAWAY
Oklahoma: The Sooners had a school-record streak with at least 30 points stopped at 15 games, but that doesn't matter much. Each of the past three years, Oklahoma has lost at least once in the first five games. And the past two seasons, they haven't lost again in the regular season on the way to a final ranking of fifth.
Texas: The Longhorns stayed close with a defense that settled down after giving up 179 yards passing to Mayfield in the first quarter, and a couple of penalty-aided touchdown drives that finally got them within a score early in the fourth quarter. Avoiding a blowout should help Texas going forward.