The Gamecocks ended a four-game losing streak in Southeastern Conference play and knocked the Gators out of contention in the muddled Eastern Division.
The loss also could be the end for Gators coach Will Muschamp. The fourth-year coach has been on the hot seat all season, and a three-game losing streak at home could be the final blow in what's been a mediocre tenure.
''Sometimes you have to just say it was meant to be,'' South Carolina coach Steve Spurrier said. ''It was meant to be for us to win this one.''
Florida's biggest problem Saturday was special teams. The Gamecocks blocked a field goal in the fourth quarter that would have given the Gators a 10-point lead with a little more than 3 minutes to play. Florida also had a punt blocked with 39 seconds left, setting up the game-tying touchdown.
Mike Davis recovered fumbled pitch in the end zone for a touchdown, and the extra point tied the game at 17 with 12 seconds remaining.
It surely will be deemed an inexcusable collapse for the Gators - and Muschamp. Florida nearly lost to Kentucky and Tennessee early in the season and then dropped home games to LSU and Missouri. The Gators should have won both, losing to LSU after dropping a would-be touchdown in the final minutes and getting drubbed by Mizzou because of six turnovers.
Florida also allowed Missouri to score on a kickoff return for a touchdown and a punt return for a score.
The latest loss was especially bad because South Carolina limped into the game with one of the worst defenses in the league and the country.
It may have been the final game in the Swamp for Spurrier and Muschamp. The ''Head Ball Coach'' said last week he plans to return for an 11th season, but there's no guarantee he will be around when the Gamecocks return to Gainesville in 2016.
''I'm getting old when you start feeling for the other coach,'' said Spurrier, who has developed a close relationship with Muschamp.
South Carolina looked like it would roll early. The Gamecocks scored on their first two possessions, getting anything they wanted against Florida's defense.
Spurrier's team had outgained Florida 136-6 late in the first quarter. But the Gators seemingly woke up about an hour later than the noon kickoff and got things going.
Florida evened the scored on Treon Harris' 11-yard pass to Demarcus Robinson and then went ahead on Matt Jones' 1-yard run late in the third quarter.
The Gators scored 17 unanswered points and looked like they would put the game away with a 32-yard field goal with 3:31 remaining. But Frankie Velez's kick was blocked, giving South Carolina life.
Florida responded with a defensive stop, but did nothing when it got the ball back. The Gamecocks brought all kinds of pressure on the punt, and Kyle Christy's kick was blocked.
South Carolina scored four plays later, getting some help on a pass interference penalty in the end zone.
Florida, meanwhile, was one-dimensional on offense for the second time in three weeks.
South Carolina entered the game giving up more than 460 yards a game. The Gamecocks forced a combined five punts in their last two losses against Auburn and Tennessee.
Florida punted five times in the first three quarters alone Saturday.