Updated

The way Kansas State coach Bruce Weber saw it, his 22nd-ranked Wildcats had two chances to lose to Texas on Tuesday night.

The Longhorns blew the first once. They made no mistake on the second.

Jonathan Holmes made a catch-and-shoot 3 pointer at the buzzer to send Texas to a 67-64 victory, the Longhorns' fourth straight win in the Big 12 and second in a row over a ranked team.

The play came after the Wildcats' Shane Southwell made a twisting, off-balance layup to tie it at 64 with 5 seconds to play.

Texas had almost wasted its chance for the game-winner when an inbounds pass with 3 seconds left went to the wrong player near midcourt. But a quick timeout saved just enough time, and Isaiah Taylor zipped the ball to Holmes in the corner, and he put up the shot over two defenders.

Had Taylor seen Holmes slip his defender the first time, Holmes would have walked in for a layup. Instead it was the arcing long ball over two defenders that added a little more drama and took more skill, but still delivered the knockout.

"They ran the same kind of play. ... He could have scored easily," Weber said.

"I just caught it and shot it," Holmes said, adding he had no time to think before putting the ball in the air.

The Longhorns (15-4, 4-2) are giving the Big 12 plenty to think about. A team that started with no expectations after a losing season in 2012-13, the program's first in 15 years, is now feeling like it can chase the league heavyweights over a long season.

And maybe even challenge for the title.

"That's what we're playing for," Holmes said.

Kansas State (14-5, 4-2) had the same mindset after a 4-1 start in the Big 12 that came during an impressive run of 12 wins in 13 games. The Wildcats dropped a key road loss they may later regret letting get away, Weber said.

"We had our opportunities," Weber said. "It's going to be like this all year in the league. You've got to protect home court and find a way to win some road games."

Cameron Ridley scored 18 points for Texas while Javan Felix had 23 including two big baskets late that helped prevent the Wildcats from taking the lead.

Thomas Gipson scored 24 for Kansas State in a game-long tug-of-war with Ridley under the basket. That matchup epitomized a physical game in which neither team let the other find any offensive rhythm.

The biggest lead was six points. The teams were tied or traded leads 12 times in the final 9 minutes.

"We let them get us in a grinder a little bit," Texas coach Rick Barnes said.

Gipson's play against Ridley kept the Wildcats close the entire game. The Longhorns had a chance to push the lead to eight late in the first half before Ridley was whistled for an offensive foul and Gipson made a layup as time expired.

Ridley picked up a second foul early in the second half and went to the bench for nearly 4 minutes. Gipson converted the three-point play and the Wildcats cut the lead to 40-39 when Gipson scored again. Ridley returned and quickly made a midrange jumper on his first touch, then denied Gipson a shot on the other end.

"He was really good offensively, he knows how to use his body well," Ridley said of Gipson. "I shot every shot with confidence. They kept trusting me to throw it back to me."

Kansas State grabbed the lead at 52-49 when Southwell made two free throws and Wesley Iwundu made a fastbreak layup. Felix briefly restored Texas' lead with a baseline floater, his first points in nearly 6 minutes, before Southwell made a 3-pointer that started a flurry of back-and-forth lead changes and ties.

"We had our chances," Weber said. "To win in this league, you have to be extra special."