AMES, Iowa (AP) -- With less than 12 minutes left, Texas was staring at a 21-point deficit and the very strong possibility of a losing record in the Big 12.
The Longhorns still lost, and they still fell below .500 in league play.
They also nearly pulled off one of the greatest comebacks in school history.
Georges Niang scored 19 points, Bryce Dejean-Jones had 18 and 15th-ranked Iowa State held off No. 19 Texas 89-86 on Monday night.
Jameel McKay had 14 points for the Cyclones (15-4, 5-2 Big 12), who let Texas score 23 points in the final 2:58 and yet still managed to hang on for their fourth win over a Top 25 opponent.
"When we down 21 (I said), `We'll see what we're made of here.' Our guys fought. They kept fighting. We got aggressive," Texas coach Rick Barnes said.
For 28 minutes, the Cyclones looked as good as they have all season.
Then they let the Longhorns look even better.
Iowa State broke open a tight game with a 27-12 run and went ahead by 21 with 11:36 left. The desperate Longhorns answered with a furious rally, scoring 47 points in just more than 11 minutes, and pulled to 87-84 on Jonathan Holmes' 3-pointer with 22 seconds left.
Javan Felix scored 20 points and Isaiah Taylor had 17 for Texas (14-6, 3-4), which has dropped consecutive games for the second time this month.
Holmes had 17 points with 10 rebounds, and Longhorns freshman Myles Turner scored in double figures for the fourth time in five games with 16 points.
"Javan was terrific. He kept his cool the whole time. For Isaiah, I thought it was by far one of his best (games). I mean, he did everything we asked him to do," Barnes said.
The Cyclones and Longhorns were widely believed to be among the strongest challengers to Kansas' 10-year hold on the Big 12 title. But Iowa State's 78-73 loss to the Red Raiders on Saturday and the 75-62 defeat Texas took against the Jayhawks in Austin left each team searching for a response.
The Cyclones beat the Longhorns - barely - by going around them.
Iowa State compensated for a major size disadvantage by attacking the Longhorns' zone with precise ball movement, and back-to-back alley-oops from Niang to McKay put the Cyclones ahead 36-23.
Niang opened the second half with a 3 to help Iowa State jump ahead 47-30, and a transition dunk by Monte Morris put the Cyclones up 51-33.
Still, it took free throws from Niang and McKay in the final 20 seconds to stave off what would have been a crushing defeat for Iowa State.
Morris had 13 points and six assists for Iowa State, which allowed an astounding 23 field goals in the second half.
"I loved our energy out of the gate," coach Fred Hoiberg said. "Down the stretch, that was crazy. An absolutely crazy game."
Texas: The Longhorns grabbed eight offensive rebounds in the first 12 minutes. ... Felix and Taylor combined for 31 points in the second half.
Iowa State: The Cyclones stuck with their usual starting lineup and scored on their first five possessions after Iowa State let Texas Tech go ahead by 19 points in less than 13 minutes.
Texas had 61 points in the second half - the same total Oklahoma State had in both halves of a two-point loss at Iowa State to open Big 12 play. ... Iowa State's seven league games have been decided by a total of 24 points.
"The tempo we played with the last 12 minutes is what we started the season with. We've got to get back to that," Barnes said.
Texas plays at Baylor on Saturday.
Iowa State hosts TCU on Saturday.