AUSTIN, Texas (AP) On the brink of being upset, Texas put the game in the hands of quarterback Sam Ehlinger and on the foot of the Longhorn player that coach Tom Herman refuses to call by name.

Ehlinger came through again. So did Cameron Dicker the kicker.

Given the ball with just 1:11 to play after Kansas had taken a one-point lead, Ehlinger drove the Longhorns to the Jayhawks' 21-yard line.

Dicker did the rest, calmly booting a 33-yard field goal as time expired to send the No. 15 Longhorns to a 50-48 victory in a wild game with a frantic fourth quarter that saw the teams exchange six touchdowns, two field goals and a blocked extra point for a 2-point safety.

''I love kickers,'' said Herman, who makes a joke of not saying a kicker's name, and still didn't in his postgame news conference. ''I'm glad that we have the one we have.''

It's the second career game-winner the sophomore has delivered for the Longhorns. His field goal in the final seconds beat Oklahoma last season. After beating Kansas, the student section of fans was chanting his name.

''When we got into 10 seconds left ... I was ready to go,'' Dicker said. ''I felt pretty confident going into this. Going in and nailing it felt pretty good.''

Kansas, under first-year coach Les Miles, nearly had a victory that would have stunned the Big 12 and knocked Texas out of the ranks of favorite to get to the league championship.

And the Jayhawks (2-5, 0-4) were oh-so-close.

Pooka Williams rushed for 190 yards and two touchdowns and Carter Stanley passed for 310 yards and four touchdowns for the Jayhawks. Stanley's 22-yard scoring pass to Stephon Robinson and 2-point conversion throw to Daylon Charlot put the Jayhawks ahead.

''They fought their heart out,'' Miles said. ''They have everything they had.''

Ehlinger was just slightly better in crunch time.

Ehlinger finished with 399 yards passing and four touchdowns. He also ran for 91 yards to save Texas on a night the program honored its 1969 national championship team with special uniforms and a halftime celebration.

He completed six passes on Texas' final drive and ran for a first down on third down. He threw two touchdown passes in the fourth quarter to Devin Duvernay, who finished with eight catches for 110 yards.

Texas may need Ehlinger to be that good every week as the Longhorns' defense continues its struggles heading in the back half of the Big 12 schedule and the Longhorns hoping to get a championship game rematch with No. 5 Oklahoma.

''A win's a win,'' Ehlinger said. ''Very thankful we were able to pull that out.''

THE TAKEAWAY

Kansas: The Jayhawks came in with the worst offense in the Big 12 but they were explosive under new offensive coordinator Brent Dearmon, who was calling his first game after being promoted by Miles two weeks ago. Dearmon was coaching at NAIA program Bethel University last season but dialed up big-hit plays against the Longhorns time and again.

''I got guys that are fighting like hell to be a part of what we're doing here and Dearmon is one of them,'' Miles said.

Texas: The Longhorns defense came in as the worst in the Big 12 and lived down it. Texas gave up huge chunk plays, whiffed on tackles, looked lost in coverage and couldn't protect a lead. The Longhorns have allowed three 100-yard rushers in the last two games.

''They have a great running back who can make a lot of people miss in space, who is very explosive,'' Texas linebacker Joseph Ossai said.

ROACH TENTACLES

Texas defensive end Malcolm Roach was suspended for the first half after a targeting penalty a week earlier against Oklahoma. He made a big impact with his return as Williams found tougher running in the second half. Roach also got the surge up the middle to block the extra point that Texas returned the other way. Herman called it the ''play of the game.''

POLL IMPLICATIONS

This was the kind of game that could drop Texas in the rankings if voters decide to punish them for nearly losing at home to the worst team in the Big 12. Herman noted the Longhorns gutted out a win on weekend other ranked programs lost, but this one felt like Texas might pay a price.

SLOPPY SPECIAL TEAMS

Kansas kicker Liam Jones had a rollercoaster night. He kicked two fields, including a career-long 46-yarder. He also missed one, had another one blocked and had the extra point blocked in the fourth quarter. He also kicked three kickoffs out of bounds.

UP NEXT

Baylor host Texas Tech on next Saturday.

Texas plays at TCU next Saturday

---

More AP college football: https://apnews.com/tag/Collegefootball and https://twitter.com/AP-Top25

Copyright 2019 by STATS LLC and Associated Press. Any commercial use or distribution without the express written consent of STATS LLC and Associated Press is strictly prohibited.