ST. LOUIS (AP) -- - There were times this season that Kentucky coach John Calipari wondered whether his team, long on talent and short on experience, would ever buy into the gospel he'd been preaching.
Seems like they've bought in just in time.
After knocking off Kansas State and then ending Wichita State's pursuit of perfection, the eighth-seeded Wildcats are marching on in the NCAA tournament. They'll play No. 4 seed Louisville, their bitter rival, on Friday in the Midwest Regional semifinals in Indianapolis.
''I told them after the game, 'I've been hard on you, like I've been on every team,''' Calipari said after a thrilling 78-76 win over the top-seeded Shockers on Sunday, a game that wasn't over until Wichita State guard Fred VanVleet missed a 3-pointer at the final buzzer.
''It's just been a long process with these guys,'' Calipari said, ''but at the end of the day, they're understanding what's acceptable and what's not acceptable.''
Also advancing to the Sweet 16 out of St. Louis was No. 10 seed Stanford, which held on through a tense final few seconds to beat second-seeded Kansas 60-57 on a rough day for fans from the Sunflower State. The Cardinal will play No. 10 seed Dayton on Thursday in the South Regional semifinals in Memphis, Tenn.
''We beat a very good Kansas team,'' said Stanford coach Johnny Dawkins, who was considered to be on the hot seat entering the tournament. ''I could not be more proud of guys.''
Nor could Calipari, whose youthful team began the season No. 1 in the nation, and then lost so many games some wondered whether it belonged in the NCAA tournament at all.
The Wildcats (26-10) were criticized. They were dissected. They were written off.
Then they started to pick up steam in the SEC tournament, coming within a hair of knocking off Florida in the finals. And they've continued to play well in the NCAA tournament, beating Kansas State on Friday before knocking off the previously unbeaten Shockers.
''That's a great team, and they have a lot of great players on that team,'' Aaron Harrison said. ''It was a joy just playing the game. Battling is really fun.''
The game went back and forth the entire way, Kentucky finally taking a 73-71 lead when James Young knocked down a 3-pointer with less than 2 minutes to go. Early answered with a basket for Wichita State, and Andrew Harrison made two free throws for Kentucky. Baker banked in a 3 for the Shockers, and Randle made two more foul shots for the Wildcats.
''Both teams were making plays,'' Wichita State coach Gregg Marshall said, his voice sounding tired. ''Back and forth, back and forth.''
Early's two free throws with 9.8 seconds left got the Shockers within 77-76, and they got their chance to add another chapter to their miraculous story when Andrew Harrison made the second of two free throws and Early pulled down the rebound.
VanVleet raced up court and called timeout with 3.2 seconds left.
Marshall drew up a play that had Tekele Cotton inbounding the ball to VanVleet, and after a couple dribbles he took a shot from the top of the key. But it was wide the entire way, clanking off the rim and sending the Wildcats pouring onto the court to celebrate.
Cleanthony Early scored 31 points and Ron Baker had 20 for the Shockers (35-1), who hadn't lost since last year's Final Four while taking an entire city - and state - on quite a ride.
''You're going to go through some humps in your life, kind of like this one. It's tough to see us go out like this,'' Baker said. ''At the end of the day, someone's got to go home.''
Turns out the Shockers were following the Jayhawks back to Kansas.
Andrew Wiggins was held to four points on 1-for-6 shooting for the Jayhawks in what could have been his final college game, while Dwight Powell had 15 points and seven rebounds despite playing with four fouls much of the second half for the Cardinal.
''To beat a team like this, a storied program with great coaching, great players, always feels amazing,'' Powell said. ''So as of right now we're still in the race and we're still playing in March, and it feels great.''
Tarik Black had 18 points and six rebounds for the Jayhawks, but he fouled out with 5:25 to go. Conner Frankamp had 12 points on four 3-pointers, the last two in the final 23 seconds to make it close after Stanford had pulled ahead by seven.
Stanford was 9 for 12 at the free throw line over the final 2:04 and needed all those points. Frankamp's second 3-pointer narrowed the gap to 59-57 with 14.9 seconds left.
Anthony Brown hit one of two free throws with 12.9 seconds to go and Frankamp banged a third 3-point attempt off the glass near the buzzer in a bid to tie it.
''I knew when that left my hand it was off,'' Frankamp said. ''I didn't get a great look at it.''