WICHITA, Kan. -- So many thoughts were running through Rob Gray's head as he dribbled near midcourt, time winding down in a tied NCAA Tournament game, that Houston's star guard nearly ran out of time.
"I was thinking to myself, I'm a senior, I've never been in March Madness. This is what I live for," Gray said later. "A small thought ran through my head: I thought about Cincinnati, how I had a chance to win that game for us and I didn't, and I just wanted to come through for us."
Finally deciding it was time to go, Gray drove for a wind-milling layup that trickled over the rim with 1.1 seconds left. And when San Diego State's Trey Kell missed a tough 3-pointer at the buzzer, the No. 6 seed Cougars had a heart-stopping 67-65 first-round win Thursday night.
Gray had come through where he failed in the American Athletic Conference title game.
"There's a lot of ways you have to win games, a lot of times you just have to do it from the seat of your pants," said Cougars coach Kelvin Sampson, in the tournament with his fourth different team. "The difference in the game tonight is that we had Rob Gray and they didn't."
Devin Watson had just tied the game for the Aztecs with a turnaround 3-pointer, his second in a matter of seconds, when Gray dribbled up floor with 29 ticks left. He allowed the clock to melt down to six seconds before crossing over, scooting beneath two defenders and scooping up his shot.
The layup gave him 39 points and the Cougars (27-7) their first NCAA Tournament win since 1984, when coach Guy Lewis took Hakeem Olajuwon and several members of Phi Slamma Jamma to their third consecutive Final Four.
"It means a lot to our program, especially sitting next to Coach Sampson. He's a big part of why I'm here. Rob's a big part, too," the Cougars' Devin Davis said. "We survived to play another day."
Jalen McDaniels had 18 points to lead No. 11 seed San Diego State (22-11). Kell finished with 12 points and eight rebounds, though it's the three points he missed at the end that will stand out.
Houston will play third-seeded Michigan in the West Region on Saturday.
"It's always bitterly disappointing when the season ends, especially when you feel like you have good basketball left," Aztecs coach Brian Dutcher said. "It's March. We had a March-type shot to win the game and it didn't go home. We're disappointed over that."
The Cougars struggled much of the first half to deal with the Aztecs' length, especially McDaniels and Malik Pope, the 6-foot-11 forwards who effectively clogged up the paint.
Houston finally started to open things up when it began drawing fouls late in the half.
Gray did most of the damage, hitting an array of floaters and lay-ins before a 3 from about 30 feet gave the Cougars a 39-29 halftime lead. Gray finished the half with 16 points, even though he went to the bench for a short stretch with two fouls.
For long periods in the second half, the best offense for either team came at the foul line.
McDaniels went to the stripe four times in five trips for San Diego State, and Gray answered with three straight trips for Houston. That was part of a stretch in which the Cougars mustered a single field goal over more than 10 minutes, allowing the Aztecs to slowly whittle away at their deficit.
Watson finally tied the game with a deep 3-pointer with just over a minute left, only to watch Gray answer with a 3 of his own to give Houston a 65-62 lead with 39.4 seconds remaining.
Watson got the ball in his hands again, this time spinning around on the wing for a can-you-top-this 3-pointer that electrified a vocal section of fans opposite the San Diego State bench.
Turned out that Gray would top it one more time.
"Two really good teams. Neither wanted to lose," Sampson said. "Rob had it going. He had it going. So we were going to ride that horse until they stopped it."
San Diego State had won nine straight games, including its run to the Mountain West Conference Tournament championship, before running into the Cougars. The nail-biting loss dropped the Aztecs to 1-5 in games decided by four points or fewer this season.
Houston made the most of its first NCAA Tournament trip since 2010, becoming the sixth team in school history to reach 27 wins. Now, the Cougars can aim for their 28th.
San Diego State heads home while Houston turns its attention to Michigan in the second round.
More AP college basketball: https://collegebasketball.ap.org; https://twitter.com/AP-Top25 and https://www.podcastone.com/ap-sports-special-events