AUSTIN, Texas (AP) — Texas needed a win to keep any lingering Big 12 title hopes alive.
The Longhorns got it behind the same fourth-quarter formula they used a few weeks ago: Give up a late lead before quarterback Sam Ehlinger engineers a long drive to set up a Cameron Dicker field goal as time expires.
Dicker's 26-yarder lifted the Longhorns to a 27-24 victory over No. 20 Kansas State on Saturday. The victory keeps Texas in the hunt for a return trip to the Big 12 championship game with three games left.
With two losses already, they'll still need some help. But the Longhorns (6-3, 4-2) at least are still alive. They fought back after falling behind 14-0 in the first quarter, then rallied again after letting their own big lead evaporate.
"It could have been a really, really bad scene," Texas coach Tom Herman said. "The win is obviously very important for us. The way that it happened, to be down 14-0 in the blink of an eye ... We put ourselves on the ropes (this season) and we took a step toward swinging and scratching and clawing our way off."
Dicker has booted two-game winners on the final play in Texas' last three games. His 33-yarder beat Kansas in a wild 50-48 finish on Oct. 19.
Against Kansas, Ehlinger had 71 seconds to get the Longhorns within scoring range, and he did it with a frantic but crisp push. Against Kansas State, the Longhorns went 65 yards in 13 plays and sucked the final 6 minutes, 45 seconds off the game clock.
This time, Texas looked to be setting up for the field goal until Ehlinger surged into the end zone on a keeper. After an illegal formation penalty nullified the touchdown, Ehlinger fell on the ball the next play and Dicker trotted on for the kick
"As bad as we all wanted to score to cap off that drive, the smart thing was to set up the field goal and not let them get back on the field," Ehlinger said.
Even that might have had some uncertainty.
Dicker's regular holder, punter Ryan Bujcevski, didn't play because of a broken collar bone. That left backup holder Chris Naggar handling the ball on the final play. The snap, hold and kick were flawless.
Dicker, who was seen entering the stadium before the game with his shirt untucked and unbuttoned under his sport coat, was as cool as ever.
"When Sam kneeled the ball, I saw the time," Dicker said. "Whatever wins is cool."
The win also made Texas bowl eligible.
Keaontay Ingram rushed for 139 yards and two second-half touchdowns for the Longhorns. His second one put Texas up 24-14 early in the fourth quarter. Kansas State rallied to tie it on Joshua Youngblood's 98-yard kickoff return and Blake Lynch's 45-yard field goal.
Kansas State's Skylar Thompson passed for a career-high 253 yards. Thompson's touchdown passes of 70 yards to Malik Knowles and 19 yards to Wykeen Gill had the Wildcats (6-3, 3-3, No. 16 College Football Playoff) rolling early. But Thompson passed for just 36 yards in the second half.
Kansas State: Thompson was excellent early until Texas' press coverage neutralized his receivers, and the Wildcats' running game never developed. The Wildcats also got a bit sloppy with a rare fumble that ended a promising drive in the first half, and a dropped pass in the end zone in the fourth quarter. The drop would have been a difficult catch for Dalton Schoen, but he got both hands on the ball and was pulling it in before a Texas defender knocked it away.
Kansas State didn't convert a third down in the second half.
"I thought he hung in there really well," Kansas State coach Chris Klieman said. "They were bringing pressure and we were barely getting guys free."
Texas: After early miscues, the Texas defense looked better than it has all season. A healthier secondary that returned All-Big 12 safety Caden Sterns locked down the Kansas State offense over the final three quarters. The secondary didn't force any interceptions, but for once opposing receivers weren't running wide open all over the field.
"We showed you all that this is what happens when we're fully healthy," Texas defensive tackle Keondre Coburn said. "This is a great team. Our defense is really good. We've just been hurt."
The loss will knock the Wildcats down and maybe out of the Top 25. The Longhorns, who were still among those getting votes, could return to the rankings. Voters may wait to see what Texas can do the next two weeks on the road at Iowa State and undefeated Baylor.
BIG PUNT RETURN
Texas came in ranked dead last among all Football Bowl Subdivision teams in punt returns with negative total yardage. Then Brandon Jones returned a punt 53 yards in the fourth quarter to set up Ingram's second touchdown.
Kansas State hosts West Virginia on No. 16.
Texas plays at Iowa State on Nov. 16
Follow Jim Vertuno at https://twitter.com/jimvertuno