Connor Shaw saved South Carolina from itself and saved the SEC East from a Missouri runaway Saturday night.

The No. 20 Gamecocks senior quarterback, left knee sprain and all, relieved junior Dylan Thompson with 6:46 left in the third quarter and South Carolina trailing No. 5 Missouri 17-0. When Shaw was done, South Carolina was a 27-24 overtime winner and right back in the race for the division crown.

“God is great, man,” said Shaw, who finished 20-of-29 for 201 yards and three touchdowns. “I wasn’t even supposed to being playing this game. Give all the glory up top.”

Divine intervention is about the only way to explain what happened in front of 67,214 stunned fans at Faurot Field. The Gamecocks had three turnovers, gave the ball away twice more on downs, missed a field goal, gave up a 96-yard touchdown pass and trailed by 17 points facing fourth-and-6 as the fourth quarter began.

“It was a game I thought we were dead,” head coach Steve Spurrier said.

Missouri (7-1, 3-1 SEC) would have virtually put away the SEC East with a victory. Instead, South Carolina (6-2, 4-2), Florida and Georgia now sit one game back in the loss column.

“It just worked out tonight,” Spurrier said. “That’s all you can say, it was meant to be.”

South Carolina tied the game at 17-17 with 42 seconds left in regulation when Shaw found Nick Jones for a 2-yard touchdown. They narrowly escaped defeat again when Shaw found Bruce Ellington for a tying touchdown on fourth-and-goal from the 15-yard line in the second possession of the first overtime.

“For (Shaw) to come out and do what he did, that’s amazing,” said South Carolina defensive tackle Kelcy Quarles, who had six tackles and two sacks. “I love that man to death. I wouldn’t take no NFL Hall-of-Famer, no other quarterback over him.”

Place-kicker Elliott Fry hit a 40-yard field goal in the first possession of the second overtime, and Missouri’s Andrew Baggett bounced a 24-yarder off the left upright on the ensuing possession to give the Gamecocks their first overtime win in school history and the first of Spurrier’s collegiate career.

The Gamecocks finished with 498 yards, including 423 through the air. Sophomore running back Mike Davis bounced back from two first half fumbles to catch 10 passes for 99 yards and rush 19 times for 56 yards, but it was Shaw who made the difference. He came into the game listed as questionable due to an injury suffered last week against Tennessee.

“I went over to him (in the second half) and said, ‘Can you play?’ He said, ‘Sure,’ so I said, ‘We have to make the move now,’ ” Spurrier said. “It wasn’t (Thompson’s) night, and Connor gave us a shot in there. It was do or die. We had no chance in the division unless we win this one. Probably could have put him in a little earlier, but it worked out.”

Thompson finished 15-of-27 for 22 yards, no touchdowns and one interception.

“We are happy to get a win,” Spurrier said. “Who knows what can happen down the road? Missouri has four more conference games. We’ve got two more. Who knows what can happen?”

Missouri led 14-0 at halftime and added a 27-yard field goal by Baggett midway through the third quarter to take a 17-0 lead into the final 15 minutes.

Things went bad from the start for South Carolina on both sides of the ball.

Offensively, the Gamecocks started the game with two three-and-out possessions that combined for 7 yards, and that was the high point. The next possession was a ray of hope, amassing 54 yards on 12 plays, but Fry missed a 40-yard field goal to leave the score at 0-0 with 4:15 left in the quarter.

The next four drives all ended with turnovers, the most frustrating was Davis’ second fumble of the second quarter, which came on a first-and-goal carry from the Tigers’ 2-yard line. The next drive ended with a Thompson interception and the next with a failed fourth down attempt at the Missouri 34-yard line and 58 seconds left in the half.

“To come in here on the road, night game, undefeated, No. 5 team in the country, coming off a loss, to battle ourselves back in the second half, I am just extremely proud,” Shaw said. “We have the momentum, we just have to finish the next four weeks at home.”