AUSTIN, Texas (CBSDFW.COM/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.

READ MORE: Arlington Police Officer Shoots Suspect Who Allegedly 'Drove Directly Towards' Officer

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 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.

READ MORE: Domestic Violence Incident Involving Gunfire Led To Dallas Apartment Gas Explosion, Court Documents Show

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.

The Longhorns are now 6-3 and will take on Iowa State next Saturday at 3:30 p.m.

MORE NEWS: Video Shows Women Kidnapping Toddler From Garland Hotel

(© Copyright 2019 CBS Broadcasting Inc. All Rights Reserved. The Associated Press contributed to this report.)