AMES, Iowa (AP) -- It didn't matter how Texas beat Iowa State.
The Longhorns just needed to escape Ames with a win.
They survived - in a way the seething Cyclones might never forget.
Case McCoy scored on a 1-yard plunge with 51 seconds left and Texas rallied to beat Iowa State 31-30 on Thursday night.
McCoy threw for 244 yards for the Longhorns, (3-2, 2-0), who will head into next week's game against Oklahoma with at least a share of first place in the Big 12.
''I'm really excited. I think I love comeback wins on the road more than anything in football,'' Texas coach Mack Brown said. ''I just think I love them. It just says something about your toughness and your team and believing. We're getting back something we lost. We couldn't have done this the last couple of years.''
The Cyclones might argue that they couldn't have done it Thursday night either without some huge breaks.
McCoy led Texas on a 75-yard drive in just under 3 minutes - which was aided by two pass-interference penalties and two near fumbles by Johnathan Gray.
The first one was reviewed after Iowa State's Jeremiah George picked up a loose ball and started running the other way. But it remained Texas ball, much to the dismay of irate Iowa State coach Paul Rhoads.
Gray recovered his own fumble on the next play, and McCoy followed with the winning touchdown.
''To make a play on the 1-yard line with our backs against the wall...and (to) have it taken away from them, that's hard to express. You don't just put an arm around a guy and tell him it's OK when that happens to him,'' said Rhoads, his voice raising with each sentence. ''I've got pretty good eyesight. The view I had of that gigantic screen in the north end zone showed a guy that was not down and our guy with the football.''
Sam Richardson had 262 yards passing and Aaron Wimberly had 117 yards rushing and a touchdown for Iowa State (1-3, 0-1). The Cyclones dropped their 11th straight Big 12 opener - but none as heartbreaking as this one.
''So proud of the effort my kids gave to win this football game,'' Rhoads said.
The chaotic final minutes capped a game in which momentum kept swinging back and forth.
Iowa State's energy was seemingly squashed when McCoy found John Harris for a 44-yard touchdown strike to end the first half.
The Cyclones revitalized a near-sellout crowd with the longest pass play in school history.
Richardson found Quenton Bundrage on a simple slant, and Bundrage beat the Texas secondary for a 97-yard score that gave Iowa State a 20-17 lead. Texas answered on a 6-yard TD run by Joe Bergeron - which was set up by a pair of pass-interference calls that Iowa State fans also weren't too happy about.
Mike Davis then lunged at the knees of Iowa State's Deon Broomfield, drawing a personal foul that could end up being much more than that once the Big 12 reviews the tape.
''We're the least penalized team in the league coming into this game. There sure seemed to be a lot of hankies out there,'' Rhoads said. ''I'm sure they made tremendous calls all night long.''
Wimberly gave the lead back to the Cyclones after a fumble with 11:32 left. Cole Netten's 29-yard field goal made it 30-24 with 3:40 to go.
It wasn't enough though, as the Longhorns embarked on the winning drive that might end up saving their season.
''I thought when we forced the field goal ... and we had three timeouts in our pockets we would win the game. That's who we've been in in our past. I'm really proud of our guys,'' Brown said.
Jackson Jeffcoat's interception with 8 seconds left sealed the win for Texas. Gray had 89 yards rushing, including a 45-yard touchdown dash, for the Longhorns - who've bounced back from ugly losses to BYU and Mississippi with two straight wins.
McCoy started for the second time this season in place of the injured David Ash, who was out with concussion-like symptoms, and helped put Texas take a 10-0 lead before Iowa State rallied for 13 straight points.
McCoy got the Longhorns the lead back with a desperation heave. He flung the ball almost blindly into the end zone - and found Harris between three defenders to put the Longhorns up 17-13.
McCoy was far from perfect. But on a night when the Longhorns and Mack Brown desperately needed a victory, McCoy did just enough to help give them one.
Even if Iowa State likely didn't see it that way.
''I think adversity has already struck this team plenty of times and we keep finding ways to keep battling and staying together and sticking together,'' McCoy said.
Follow Luke Meredith on Twitter: www.twitter.com/LukeMeredithAP