South Carolina fouled junior forward Perry Stevenson, a 76 percent free-throw shooter on the season, but Stevenson missed both free throws with 29 seconds left on the clock. South Carolina controlled the ball and held it for a final shot by Devan Downey with 3.2 seconds left in the game.
Downey drilled the pull up shot to give the Gamecocks the lead and his 23rd point of the day.
After a couple of timeouts, Kentucky got the ball into the hand of leading scorer Jodie Meeks, who heaved a half-court shot that clanged off the front of the rim.
Kentucky fell to 16-6 overall and 5-2 in conference. South Carolina improved to 16-4 overall and 5-2 in conference.
Patrick Patterson led the Wildcats with 28 points to go along with Meeks' 20 points. Guards Zam Fredrick and Devon Downey nearly matched Kentucky's duo in point production with 47 points between them.
Kentucky returns to action on Wednesday when they face the Mississippi State Bulldogs at 7 pm eastern in Rupp Arena.