COLUMBIA, S.C. -- Kenny Miles ran past coach Steve Spurrier during South Carolina's Senior Day ceremonies with a big smile on his face.

"Kenny," Spurrier told him, "I know we did this last year. But I think this is the last year we can do this for you."

Miles made his final home game one to remember, gaining a career-high 127 yards and a touchdown as the Gamecocks (No. 9 BCS, No. 12 AP) pulled out a closer-than-expected win over FCS opponent Wofford 24-7 on Saturday.

Miles went through the Senior Day line a year ago as he strongly considered transferring with star tailback Marcus Lattimore returning healthy from a knee injury. Miles chose to stay, though, and was thrust back into backfield when Lattimore was lost to another knee injury three weeks ago.

It was Miles' first 100-yard game since 2009 when he was the team's leading rusher. He spent the last three seasons as backup to Lattimore, yet has typically come up big when called upon.

He did it again for the Gamecocks (9-2) against Wofford with a 2-yard touchdown run. Miles tried to block out the fact it was his last home game, but couldn't. "It was emotional," Miles said. "I'm going to miss playing here."

Miles helped the Gamecocks to their 11th straight home victory and their first perfect season (7-0) at Williams-Brice Stadium since 1987. It was Spurrier's 64th win at South Carolina, tying him with Rex Enright for most ever in South Carolina history.

"I hadn't thought about this one too much," Spurrier said. "That next one would maybe be a little more special."

Spurrier and the Gamecocks get their first crack at the mark next Saturday night at rival Clemson -- and they'd better not play like this against the Tigers. South Carolina couldn't rest easy until a 17-point fourth quarter

Adam Yates' 23-yard field goal broke a 7-all tie with 11:57 to go. After the Terriers (8-3) failed on a 4th-and-1 at their 34, Connor Shaw threw an 8-yard touchdown pass to Ace Sanders to widen the lead.

"We worked hard for this one," Wofford coach Mike Ayers said. "I told them at the beginning of the week, we aren't coming down here for a check, we were coming down here for a win. It's a tough one when you know you're so close and you know you almost beat Goliath."

The Gamecocks played this one without star defensive end Jadeveon Clowney, who didn't practice all week because of a sprained foot. He's expected back next week when South Carolina closes the season against rival Clemson at Death Valley.

South Carolina's won 16 straight over Wofford, who won a share of the Southern Conference this season and will likely get a bid to the FCS playoffs on Sunday.

Still, the Terriers' quirky, throwback triple-option attack has always given Spurrier's teams fits, nearly knocking off the Gamecocks when the teams met in 2006 (27-20) and in 2010 (23-13).

"These Wofford kids are tough," Spurrier said. "We knew that coming in, and we pretty fortunate to come out winning."

South Carolina looked solid at the start, even without the injured Clowney, holding Wofford to 15 total yards in the opening quarter.

The Gamecocks also were moving easily on offense, crossing into Wofford territory on their first three series. But mistakes cost South Carolina and Wofford eventually took advantage.

Shaw threw a bad interception on Wofford's 33 to linebacker Alvin Scioneaux to end one drive. Freshman tailback Mike Davis was stripped of the ball on the Terriers' 6 while heading to the end zone on another. In between, Miles had a 2-yard TD run to put the Gamecocks up 7-0.

Wofford and Breitenstein finally got going right before halftime with a 12-play, 85-yard drive. Breitenstein, the SoCon's leading rusher with 1,528 yards coming in, carried the final seven times for 46 yards including a 2-yard touchdown with 32 seconds left in the half that tied things 7-7.

Breitenstein finished with 125 yards and a touchdown.

Shaw was 16 of 20 for 122 yards, but also threw an interception and was sacked four times.

There were some boos at halftime from the 79,982 on hand, and more in the third quarter as the Gamecocks continued to struggle.

When it was over, though, the crowd celebrated the undefeated home season and Spurrier lingered on the field and waved to the fans as he walked off. Spurrier held the coaching wins record at his alma mater and now joins Bear Bryant as coaches holding such marks at more than one Southeastern Conference school.

Spurrier remains the winningest coach in Florida history with 122 victories. Bryant holds the records for most wins at Alabama (232) and at Kentucky (60).