STILLWATER, Okla. -

Iowa State doesn't win in Stillwater.

Well, not this millennium. And not since well before current coach Fred Hoiberg was a Cyclones player in the mid-1990s.

The program's last win at Gallagher-Iba Arena -- 1988.

Until Monday night.

But even then, it didn't come easy, requiring three overtimes before the No. 16-ranked Cyclones finally emerged with a 98-97 win over No. 19 Oklahoma State in a key game for both teams looking to remain in the top half of the Big 12 standings.

The Cowboys missed two shots in the final seven seconds before Hoiberg and his crew could finally breathe easy.

"I got my butt handed to me four times in this arena before the addition," Hoiberg said the now-expanded arena. "It's a hard place to play and they do a great job. Coming in on Eddie Sutton Night, we knew there was going to be a little extra emotion in this building.

"To gut this win out was huge. It would have been a very difficult loss fighting three overtimes and walking out of here with a loss. I'm proud of our guys for finding a way to win it."

Iowa State (17-4, 5-4 Big 12) won for just the third time in seven games.

Oklahoma State (16-6, 4-5) lost its third consecutive game.

The game was filled with drama.

Cyclones reserve guard Naz Long, who hadn't scored until the second overtime, drilled a 3-pointer to force the third extra period, then provided the winning points with two foul shots with 21.8 seconds to go.

Guard Markel Brown dunked with 12.3 seconds remaining to pull the Cowboys within one, and a turnover gave Oklahoma State a chance to win it. However, guards Marcus Smart and Le'Bryan Nash both missed shots, Nash's at the buzzer.

"It wasn't the way we drew it up, but I won't get into that very much," said Cowboys coach Travis Ford. "It's just a guy trying his hardest. They did a pretty good job defensively. Le'Bryan popped open and got the ball, and it wasn't a bad scenario.

"It wasn't the best shot, but we were going to have to take a tough shot at that point. We didn't execute it perfectly, but we got it inbounds and got a decent look. Not the greatest look by any stretch, but we got a look at it."

The game went to the first overtime when both teams missed opportunities on their final possessions in regulation.

Oklahoma State had the first chance, but Cyclones forward Dustin Hogue blocked Nash's shot along the baseline.

Iowa State guard DeAndre Kane dribbled the ball at the top of the key, then launched a 3-pointer that bounced off the rim. Cyclones forward Melvin Ejim was there for a follow dunk, but officials waved it off for occurring after the buzzer, a ruling that was confirmed when they went to video replay.

The Cyclones led by as many as nine in the second half before the Cowboys made a charge.

Oklahoma State led by as many as five.

"It was a great team effort," Ejim said. "We had guys come up -- Naz and Monte (Morris) made huge shots. We were just able to grit it out. It was a tough game. They're a great team with great players. We were just able to be sound and grit it out in the end."

In the first extra period, Iowa State led 83-79 with 1:38 to play but didn't score again. Guard Phil Forte drilled a 3-pointer to pull the Cowboys within 83-82. Forward Brian Williams made one of two foul shots with 28.1 seconds left to tie it, but his second went in and out, rolling off the rim.

Long was scoreless before he fired in a second-chance 3-pointer with 1.4 seconds left in the second overtime, forcing the third extra period.

The Cyclones led 36-32 at the half, getting 13 points from forward Georges Niang and 10 from Kane. Those two combined to make 10 of 12 shots from the floor.

Iowa State jumped out to an 8-1 lead and was up 13-5 before the Cowboys finally got going on the offensive end.

Brown fired in back-to-back 3-pointers, and Williams scored 12 points in the opening 20 minutes for Oklahoma State.

The Cowboys, suddenly reeling after being ranked No. 8 in the country a week ago, talked about turning their bad trend around.

"It's hard, but we have to fight through it," Nash said. "Life moves on and we have to get ready for (Texas Tech). It was a great game. I knew it was going to be a great game and we didn't come out on the good end. It was a frustrating game, even though we got them to overtime, and we were working hard and playing defense and they were hitting tough shots at the end.

"They hit a tough shot to go into overtime and you can't have that happen. We gave up a lot of offensive rebounds in the overtime and we can't do that."

NOTES: Earlier Monday, Oklahoma State dismissed freshman PG Stevie Clark from the team. Clark, a two-time state Player of the Year from Oklahoma City, was arrested for the second time in little more than a month in the early hours of Sunday. He had also been sent home from the team's trip to Orlando for the Old Spice Classic in November, for violation of team rules. Clark was averaging 5.3 points in 16 minutes per game as the Cowboys' backup point guard. ... Iowa State earned its sixth win of the season over a nationally ranked team. ... Cowboys G Markel Brown continues to climb the school's career scoring list. He moved into 12th place Monday night, and he is in striking distance of 10th-place Ivan McFarlin's 1,526 points.