Thompson entered the game on the final series for an injured Connor Shaw and fired a long pass down the middle on second down which Ellington grabbed at the 5-yard line and ran in for the decisive score.
The game-winner came after Michigan had scored with 3:29 remaining on a pass from Devin Gardner to Jeremy Gallon.
Thompson finished 7-of-9 through the air for 117 yards and a pair of touchdowns while Shaw also fired two scoring passes on 18-of-26 efficiency for the Gamecocks (11-2), who matched the school record for most wins in a single season, first set last season.
Ace Sanders hauled down a pair of TD passes en route to nine catches for 92 yards and also returned a punt 63 yards for a score in South Carolina's victory.
Gardner completed 18-of-35 passes for 214 yards, three TDs and an interception for the Wolverines (8-5).
Gallon made nine catches for 145 yards with a pair of scores and Denard Robinson ran the ball 23 times for 100 yards in Michigan's loss.
2014: The Year in Music [PHOTOS]