Updated

AUSTIN, Texas (AP) -- Headed to overtime for the second time this season, Texas coach Tom Herman gathered his offense for a pep talk.

"Just like at USC," he told them.

"Yean, except we're going to win this time," junior offensive guard Patrick Vahe shot back.

There's a new attitude at Texas under Herman and it's starting to pay off in the win column.

Texas running back Chris Warren III scored on a 2-yard touchdown run in the second overtime when the powerful running back moved a pile of Kansas State tacklers across the goal line, sending the Longhorns to 40-34 win Saturday night.

Warren appeared to be stopped short, but refused to go down and kept pushing his 250 pounds forward . Helped by a push of the pile by his teammates, Warren bowled into end zone, taking several Wildcats with him.

The touchdown came after Kansas State's Matthew McCrane missed a 53-yard field goal attempt that bounced off the left upright.

The win puts Texas (3-2) at 2-0 in the Big 12 for the first time since 2013, the last time the Longhorns played for the league crown.

"There's a lot of good energy in that locker room," said Herman, who was hired after the Longhorns had three straight losing seasons. "I'm really proud of how in the last two weeks how much we've grown up."

Freshman Sam Ehlinger passed for 380 yards and two touchdowns in his third career start for Texas. He also ran for 107 yards, using his legs for big gains on the game-tying drive in the fourth quarter and to set up Warren's game-winning score in overtime. Ehlinger even helped moved the pile.

"We got a big push and won the physical battle," Ehlinger said.

Kansas State (3-2, 1-1) quarterback Jesse Ertz threw touchdown passes of 82 and 12 yards to Dalton Schoen in the first half. But Ertz took himself out of the game after an awkward trip and fall on a short run in the third quarter. The Wildcats trailed but Alex Delton came in and ran for the tying touchdown and later drove the Wildcats to a go-ahead field goal in the fourth quarter. Delton also ran for a touchdown in the first overtime.

THE TAKEWAY

The Wildcats will feel like they let a tough road win get away. The Wildcats led by 10 in the first half and had fought back to lead again in the fourth. But the Wildcats' typically stout defense gave up big chunks of ground to Ehlinger late as the Longhorns sent the game to overtime. Delton gave them a boost with his legs late, but the Wildcats could have used Ertz' arm in overtime.

"Everybody is in shock right now," Kansas State cornerback D.J. Reed said. "I don't think we were ready for the freshman quarterback to be a good scrambler like that."

The Texas offense is growing up behind Ehlinger, who is now 2-1 as starter and seems to get more comfortable with every throw. While Texas has said Shane Buechele has been dogged with shoulder and ankle injuries this season, Ehlinger is becoming the leader of the Longhorns offense and gives them a powerful running dimension when plays break down.

Ehlinger's 487 yards of total offense rank third in school history.

"Sam is a tough, tough kid," Herman said. "He made a lot of freshman mistakes, but he overcomes them with toughness and tenacity."

Herman still wouldn't commit to Ehlinger has his regular No. 1.

"I'm not going to think about the decision of who is going to play quarterback next week until I watch the film and see how healthy Shane is," Herman said.

KILLER PENALTIES

Consecutive holding penalties in the second overtime doomed Kansas State. A Delton run inside the 10 was called back and another holding call two plays later kept pushing the Wildcats backward. That forced Kansas State to throw before trying the long field goal and Delton's kick bounced off the goal post.

PROTECTING EHLINGER

Texas came in with patchwork offensive line and it held up well. With new starters at both tackles and center, the Longhorns didn't give up a sack. Ehlinger's scrambling and called runs helped with that, but it was arguably the unit's best game of the season. The Longhorns also averaged 4.2 yards rushing.

UP NEXT

Kansas State hosts No. 8 TCU.

Texas plays No. 3 Oklahoma in Dallas.