ORLANDO, Fla. (AP) -- South Carolina running back Mike Davis knew what he had to do and he was ready to get it done this time.
When former Gamecocks running back Marcus Lattimore was lost for the season in a game last year due to a knee injury, Davis was thrust into a role he later acknowledged he wasn't quite prepared to step into.
That was then.
This time, when starting quarterback Connor Shaw when down Saturday, there was no panic or doubt in Davis.
The sophomore running back took over the game, rushing 26 times for 167 yards and three touchdowns as No. 12 South Carolina overcame injuries, four turnovers and a 10-0 halftime deficit to beat UCF 28-25.
''Whatever the coaches call, I am here for,'' Davis said. ''I didn't have any frustrations at all. I believe in our team and we all consider ourselves as brothers so we always believe in each other...We stuck to the same things that we do. If one person goes down, the other person has to step up.''
The Gamecocks played the final three quarters without Shaw. The QB was dragged to the ground by UCF linebacker Terrance Plummer and fumbled. The Knights recovered the ball and Shaw came up holding his shoulder. Shaw returned to the sideline wearing a sling and ice pack.
When South Carolina started the third quarter, it was Davis time.
He had 150 yards rushing in the second half and said even though he was a little sick, he embraced having his number called down the stretch.
Early in the game, it was the Knights who were sharp, but they failed to convert all but one of the Gamecocks' miscues into points.
UCF managed to withstand Davis' onslaught, but rallied late. But the Knights had four turnovers of their own, two of which set up South Carolina scores.
''I can't say it got away,'' Knights coach George O'Leary said. ''We have a lot of young kids and we can't sustain on turnovers and short fields...When you have a chance to make plays you have to make them and we didn't make enough plays in the second half.''
Knights' quarterback Blake Bortles threw for 358 yards and two touchdown passes, but also had two interceptions and a fumble.
The win was costly for the Gamecocks. After Shaw was injured, South Carolina (3-1) also lost second-string tailback Brandon Wilds in the third quarter with a left elbow strain.
Coach Steve Spurrier said he hopes Shaw will be able to return in two weeks; he said Wilds could be back in three weeks.
Shaw was replaced by junior Dylan Thompson, who completed some early throws but had several potential big-play passes dropped by receivers. He finished the game 15 of 32 for 261 yards and an interception.
Both Thompson and the Gamecocks' offense settled down in the third quarter, relying on their rushing attack to take control of the game.
''Somebody on top is looking out for our team right now because our mental decisions that we were making, we easily could have lost,'' Spurrier said.
Even when it looked like South Carolina had taken control of the game, UCF (3-1) - playing in front of its first sellout crowd since 2011 - never stopped competing.
The Knights closed to within 28-18 with 10:13 to play in the game on Bortles' 73-yard touchdown pass to Rannell Hall and subsequent 2-point conversion.
South Carolina punted on its ensuing possession, but a UCF drive that started inside the Gamecocks' 40 ended with Bortles' second interception of the day.
But the Gamecocks couldn't seal the victory.
With less than four minutes to play, the Knights fell on a fumble inside their own 5 and struck quickly with a 3-play, 95-yard drive capped by a 7-yard touchdown pass from Bortles to Hall.
South Carolina recovered the ensuing onside kick and was able to run out the clock.
''For the first half, we were the better team,'' UCF linebacker Terrance Plummer said. ''But they made plays in the second half and we didn't make plays until it was too late.''
UCF had all the early momentum and led 10-0 at halftime. It was the first time the Gamecocks had been shut out in a half since 2010. The Knights dialed up more blitzes with Shaw out. But UCF missed on a handful of opportunities that would have stretched out their lead.
South Carolina now heads back into Southeastern Conference play with three of its next four on the road. Spurrier was happy to be leaving Orlando with a win.
''We're very fortunate, very thankful,'' he said.
Follow Kyle Hightower at https://www.twitter.com/khightower.