After coming up short against a pair of ranked teams earlier this season, the Gators have something to feel good about.

When the NCAA tournament rolls around, their win Tuesday night will likely feel even better.

In front of a raucous home crowd and more than 20 NBA scouts, No. 19 Florida harassed a young No. 13 Kansas team into a first-half meltdown and made several key plays down the stretch to survive and earn a critical 67-61 nonconference victory.

“There may not be a team in the country that has a ceiling as high as they do,” Gators coach Billy Donovan said of the Jayhawks. “Those guys are going to have to learn some things, and there’s a process those guys have to go through.”

Florida (7-2) came perilously close to blowing another late lead when freshman sensation Andrew Wiggins caught fire for Kansas late in the second half. After trailing by 18 points before halftime, the Jayhawks cut the Gators’ lead to 60-55 with 56 seconds remaining when Wiggins hit his third 3-pointer in a span of 1:27.

The 6-foot-8 prodigy, who continues to draw comparisons to LeBron James and other NBA greats, finished the game with a career-high 26 points and 11 rebounds — the first double-double of his college career.

However, his late outburst wasn’t enough. UF’s Casey Prather, who finished with 12 points after coming in averaging a team-best 19.1 points per game, hit eight free throws in the final 2:11 to ice the game.

“That loss is on everybody,” Wiggins said. “No one on the team takes all the pressure or negativity. We win together and we lose together.”

Each team was coming off a loss at the buzzer in its previous game. The Gators’ defeat came Dec. 2 at then-No. 12 UConn, falling 65-64. UF had also lost in its only other game against a ranked team, losing 59-53 at then-No. 20 Wisconsin on Nov. 12.

In the early going Tuesday, it appeared as if the Gators would win in a blowout. After falling behind 10-3 fewer than five minutes into the first half, UF ripped off a 21-0 run over the next 8:43 to take a 24-10 lead.

Dorian Finney-Smith, who finished with 15 points, buried two of his four 3-pointers as part of the run while Kansas (6-3) completely melted down, throwing errant passes and battling one another for loose balls.

“They played great,” Kansas coach Bill Self said. “We were awful.”

While the Gators’ offense was humming, a flustered Jayhawks team turned the ball over 16 times in the first half before finishing with a season-high 24 turnovers.

“I’ve never seen anything like that, honestly,” UF freshman guard Kasey Hill said. “We were just playing good defense and had them turning the ball over and throwing it everywhere.”

Scottie Wilbekin returned after missing the final three minutes of Florida’s heartbreaking loss to Connecticut because of an ankle injury and scored a team-high 18 points on 7-of-12 shooting.

He also helped anchor UF’s 1-3-1 zone that confused an inexperienced Kansas squad that will likely continue to get better with more experience as the season progresses.

“I don’t think they were prepared for him to have the kind of night he did,” said UF center Patric Young, who scored 12 points and continues to play well this season.

Florida has now won 21 straight home games for the second-longest streak in program history. UF’s last home loss came on Nov. 11, 2012.

“I don’t know if our student body is going to pass any of their final exams,” Donovan said when asked about the game’s atmosphere. “It was a great crowd, great environment. I’m very thankful people came and had the enthusiasm they did.”