MORGANTOWN, W.Va. -- Its NCAA chances all but gone, West Virginia showed it still has some fight left in a lackluster season.
West Virginia built a 25-point lead and had to withstand 41 points by freshman Andrew Wiggins and a furious comeback by No. 8 Kansas to upset the Jayhawks 92-86 in their Big 12 regular-season finale Saturday.
''We just had to stay composed, not get too down, don't say, 'dang, they're going to come back,'" said Eron Harris, who led West Virginia with 28 points. ''You've got to always have confidence in your team that you're going to win.''
The Mountaineers (17-14, 9-9 Big 12) could have finished with a thud like they had in losing four of their five previous games that reduced them to playing for a spot in the NIT.
The young Mountaineers, who have no seniors, watched Kansas tear into the deficit behind Wiggins, who set a season high for scoring and a freshman record for the Jayhawks before fouling out in the final seconds. He also had eight rebounds, four blocks and five steals, to go along with 12-of-18 shooting from the field. Ben McLemore has the Kansas single-game freshman scoring record with 36 last season.
West Virginia made some clutch free throws in the final minute to thwart the comeback and keep coach Bob Huggins' sanity intact.
''When we get a little more experience, we'll handle those things a little better,'' said Huggins, who earned $25,000 for beating Kansas in the regular season, one of the bonus clauses in a 2012 contract extension.
Juwan Staten added 24 points and Devin Williams, WVU's star freshman, had a season-high 22 points along with 13 rebounds. It marked the first time this season that Kansas had allowed three opposing players to score 20 points.
''I thought Staten controlled the game,'' Kansas coach Bill Self said. ''Harris was terrific and Williams was by far the best big in the game.
''They were terrific and then we didn't guard at all. We've gone through stretches this year where we haven't guarded well, but that's probably as poor as we've been. But give them credit, they were a lot better than us offensively than we were defensively.''
West Virginia shot 53 percent from the floor and outrebounded Kansas 37-31.
Perry Ellis added 14 points for Kansas (23-8, 14-4), which clinched its 10th straight regular-season title a week ago and had little riding on this game. The Jayhawks will have a first-round bye in the conference tournament that begins Wednesday in Kansas City, Mo.
Kansas was without 7-foot freshman Joel Embiid, who sat out his second straight game to rest a lower back strain. Tarik Black, starting in Embiid's place, went to the bench with his second foul four minutes into the game.
The Mountaineers led nearly the entire game but fell apart down the stretch. Still, West Virginia managed to beat a ranked team for the third time in seven tries over the past month.
Kansas went more than seven minutes without a field goal spanning the halves and found itself with its biggest deficit of the season, 64-39, with 16:43 left in the game after a Harris 3-pointer.
But the Mountaineers have had trouble holding double-digit leads this season, and Kansas -- especially Wiggins -- was hardly done.
West Virginia struggled against Kansas' full-court press, and Wiggins followed Landen Lucas' three-point play with four free throws and a 3-pointer over a 47-second span to pull Kansas within 78-68 with 6:13 remaining. Wiggins scored 14 straight points at one point for the Jayhawks.
Frank Mason's 3-pointer trimmed the deficit to 85-80 with 1:24 left. But West Virginia made 7 of 8 free throws in the final minute to hang on.
Backups Lucas and Jamari Traylor couldn't keep up with Williams, who scored 10 straight points for the Mountaineers at one point. He had 18 in the first half to give the Mountaineers a 50-38 halftime lead -- the most points given up by the Jayhawks in the first half this season.
''I thought Devin played really well,'' Huggins said. ''[He] scored it through contact and made open shots, which he does in practice. And then he rebounds the ball for us. He's the one guy who can really go rebound it in a crowd.''
West Virginia had its second sellout of the season, thanks to hundreds of Kansas fans who made the 900-mile trek east and those especially coming to see Wiggins, who played his high school ball on the other side of the state at Huntington Prep.
''I've never seen him play like that,'' Huggins said. ''When he makes shots he's really difficult to defend.''