Shaw didn't start the game due to a sprained left knee, but shook off the injury to take over from Dylan Thompson in the third quarter with the Gamecocks trailing 17-0. He completed 20-of-29 throws for 201 yards, including a 2-yard TD toss to Nick Jones with 42 seconds left in regulation to force a 17-17 tie.
South Carolina got a 40-yard field goal from Elliott Fry in the second overtime, and Missouri's Andrew Baggett then missed a 24-yard attempt, handing the Gamecocks (6-2, 4-2 SEC) a victory that enabled them to keep pace with Georgia and Florida in the SEC East -- each of whom trail division leader Missouri (7-1, 3-1) by one game in the loss column.
Bruce Ellington caught two TD passes for the Gamecocks, finishing with a career-high 10 receptions and 136 yards.
Maty Mauk, subbing for the injured James Franklin, completed 11-of-25 pass attempts for 249 yards, a touchdown and an interception for the previously unbeaten Tigers.
Marcus Murphy ran for two touchdowns for Missouri.