The Gamecocks (6-5) became bowl eligible and assured coach Steve Spurrier his 24th straight college season with at least six wins.
South Carolina turned the ball over five times and the defense allowed South Alabama (6-5) to control the ball for long stretches. The Jaguars ran 21 more plays than South Carolina, but they also had five turnovers.
The Gamecocks got big plays when they needed them, with Thompson averaging almost 24 yards a competition and the defense picking off four passes, including Brison Williams' 21-yard interception return for a touchdown.
Spurrier is 52-0 in his career against teams outside the Power 5 conferences.
The victory eliminated a psychological scar for the Gamecocks, who led by 14 when the fourth quarter started and managed to finish the game off. South Carolina has lost three games this season with a two-score lead in the final period.
Thompson was one of 17 seniors honored before South Carolina's last home game. He wasn't perfect, overthrowing a couple of balls with one of them ending up an interception. But Thompson still went 10 of 17.
He also caught his first touchdown pass of his career in the fourth quarter as wide receiver Pharoh Cooper took a snap from the wildcat formation and threw a 7-yard scoring pass to Thompson in the corner of the end zone. Two plays before, Thompson had found Cooper for a 73-yard completion on third-and-10.
Skai Moore had two interceptions for South Carolina. Williams also had two picks, including his score in the second quarter that put the Gamecocks ahead 17-6.
Brandon Wilds ran 16 times for 77 yards, while Cooper caught three passes for 95 yards, ran five times for 42 yards and threw the touchdown to Thompson on his only pass that put South Carolina up 30-9 with 10:20 left in the game.
Elliot Fry kicked three field goals for the Gamecocks, including a career best 47-yarder.
South Alabama kicker Aleem Sunanon scored all of the Jaguars points, making field goals of 20, 20, 29 and 31 yards.
Hunter Vaughn started at quarterback for South Alabama, but threw four interceptions. Brandon Bridge struggled too, completing just two of his 11 passes for 19 yards. Vaughn was 15 of 23 for 151 yards.