The Wildcats (14-11, 5-9 Big 12) had one last chance for the win, but Dramane Diarra's contested putback from the right block came up short and the Sooners (19-6, 10-4) survived for their third straight one-point victory.
Gray hit a turnaround jumper from the left block to give Oklahoma a 71-70 lead with 1:15 left and Kevin Bookout blocked David Hoskins' shot in the lane to give the Sooners the ball back in the final minute.
Everett let the clock run down before pushing into the lane and missing a difficult left-hander with about 20 seconds left. That gave Kansas State one final possession.
Akeem Wright took the inbounds pass with 10.6 seconds left and dribbled upcourt before passing to Hoskins in the lane. Hoskins' turnaround shot fell into Diarra's hands, but he was unable to score against Bookout as the buzzer sounded.
It was the second straight one-point loss to a Top 25 team for Kansas State, which lost 65-64 to No. 7 Texas on Wednesday. The Wildcats have now lost nine games by five points or less, surpassing the 1938-39 and 1977-78 teams for the most losses by that margin in school history.
Oklahoma's Michael Neal went 3-for-9 from 3-point range and finished with 15 points, but had a streak of four straight games with at least five 3-pointers snapped.
Cartier Martin scored 26 points -- one less than his career high -- and Hoskins added 17 points for Kansas State. Mario Taybron, making his second straight start in place of point guard Clent Stewart, matched his career best with 12 points. Stewart, still limited by an ankle injury, played six minutes, took only one shot and didn't score.
The Wildcats came close to getting some revenge for a 69-68 loss last year to Oklahoma that's now known among Sooners fans as the "Miracle in Manhattan." In that game, the Sooners fell behind by 16 before completing the biggest comeback in coach Kelvin Sampson's 12 seasons at Oklahoma when Drew Lavender ran the length of the floor and banked in a left-handed runner at the buzzer.
This game, though, was close throughout.
Kansas State got out to a quick 11-4 lead before Neal hit back-to-back 3-pointers to tie it at 15, then made two free throws following a technical foul against Wildcats coach Jim Wooldridge to put Oklahoma ahead.
The Sooners went up 32-26 when Everett lobbed the ball inside to set up a Gray dunk, then hit a 3-pointer from the right wing.
Kansas State scored the next seven points for a brief lead on Cartier Martin's 3-pointer, but Oklahoma pushed back and took a 38-37 lead into halftime.
Alternating baskets, the two teams swapped the lead nine times in the first 5 1/2 minutes of the second half before the Wildcats created a little distance on Lance Harris' jumper that made it 56-50.
A three-point play by Hoskins with 8:20 to play gave the Wildcats their biggest lead of the second half at 63-56, but then Oklahoma started carving its way back.
Everett and Gray scored back-to-back baskets, Nate Carter added a 3-pointer and Neal connected on a jumper from the right side to tie it at 65 with 5 minutes left.
Martin gave the Wildcats their final lead at 70-69 with a jumper from the left baseline with 1:43 left.
When Diarra's putback caromed off the rim, it dropped Kansas State to 0-7 this season when opponents score 70 points or more. The Wildcats are 1-26 in their last 27 games when opponents surpass 70 points.
Oklahoma, which won its last game against Texas Tech by the same score, has won eight in a row against the Wildcats.