AMES, Iowa — Georges Niang said he felt as though he and his teammates were stuck in mud the whole night.

But when it really mattered in the final frenetic minutes, the Iowa State Cyclones found yet another dose of Hilton magic as they managed to claim an 85-82 victory over Iowa in one of the wildest episodes in the 67-game series between the two schools.

The 17th-ranked Cyclones (8-0) trailed almost the entire game, got outrebounded 49-35 and did the exact opposite of what their coach wanted in the final seconds, and still managed to beat their instate rival for the fourth time in five years.

“I honestly have no idea how we won that game,’’ Iowa State coach Fred Hoiberg said. “I look at the stat sheet and they crushed us on the boards and beat us in transition, and those were two big keys in game.’’

After trailing almost the entire game, the Cyclones finished with an 8-0 run and managed to escape amid what Hoiberg figured might have been the loudest, rowdiest crowd he’s ever seen in an arena with a reputation for such things.

“I played in what I thought was the loudest this arena had ever been against Oklahoma State many years ago,’’ he said. “But when (Mike) Gesell missed the first free throw, I could feel the vibrations.’’

Gesell, who made several key plays to help Iowa hold the lead in the second half, missed two foul shots with 13 seconds remaining as the Hawkeyes (10-2) misfired on their last four shots at the line.

Iowa, which led by as much as 10 in the first half, had an 82-77 lead after Adam Woodbury made the first of two free throws with 1:29 remaining.

Georges Niang, who led ISU with 24 points, enticed Woodbury into his fifth foul at the other end and made both free throws to cut the lead to three.

Iowa then missed a shot and Aaron White was stripped of the ball after appearing to grab the rebound. Melvin Ejim made two foul shots with 42.8 seconds left to cut it to one, 82-81.

Devyn Marble missed the front end of a one-and-one with 35.8 seconds showing and Niang quickly maneuvered inside to score and give the Cyclones an 83-82 edge.

Following an Iowa timeout, Gesell drove and was fouled, but he missed the first free throw, prompting a shower of noise from a sellout crowd of 14,384. Gesell then missed the second shot with Dustin Hogue rebounding for ISU.

“Those are the guys I would have picked to shoot those (free throws),’’ Iowa coach Fran McCaffery said of Gesell and Marble. “I know they feel terrible right now, but if I could have picked who to shoot those, that’s the two guys I would have chosen.’’

Hogue was fouled immediately and hit both shots, making it 85-82.

Hoiberg then instructed his players to foul to keep the Hawkeyes from getting off a three-point shot. They apparently didn’t hear him.

Iowa’s Zach McCabe got a wide-open shot from the top of the key but it rimmed off. Follow-up attempts from in close by White and Jarrod Uthoff also missed and time ran out, setting off a wild on-court celebration.

“I just think it shows our work ethic and the type of mentality we have day in and day out,’’ said Ejim, who scored 22 points. “Even when we’re not playing so well, we find a way.’’

White led Iowa with 25 points and 17 rebounds with Devyn Marble adding 19 points. Those two and Gesell seemed to have an answer for every Iowa State run in the game’s first 39 minutes.

“If you would have said we would outrebound them 49-35, I would have said we win the game,’’ McCaffery said. “That tells me we fought. I’m proud of our guys.

“It was just some really good players out there going at it,’’ he added.

Hogue collected 12 points and 16 rebounds after not scoring in the first half.

“Dustin was an absolute warrior at the end,’’ Hoiberg said. “I was really happy to see him hit those free throws.’’

It marks the fourth time this season that the Cyclones have rallied from a double-digit deficit to win.

“I think the game lived up to the hype,’’ Niang said. “Every little bit.’’