MIAMI (AP) Brandon Doughty's final game at Western Kentucky perfectly epitomized his career with the Hilltoppers, with a slow start followed by a record-setting finish.

Doughty threw for 461 yards and three touchdowns, and No. 25 Western Kentucky overcame an early 14-point deficit to beat South Florida 45-35 in the Miami Beach Bowl on Monday.

Doughty finished the season with 5,055 yards for the Hilltoppers (12-2), the 14th time in FBS history that a quarterback has reached the 5,000 mark. His six-year career at the school - it took him three to become the starter - ended with these numbers: 1,023 completions, 12,855 yards and 111 touchdowns.

More from FoxSports

''It's been a heck of a run,'' Doughty said just before hoisting the bowl trophy.

He was probably even better than Willie Taggart thought he would be when he signed him in 2010. Taggart was Doughty's coach for his first game and the opposing coach for his last, and his Bulls (8-5) nearly stole the show from Doughty with a pair of fourth-quarter touchdowns that got them to 38-35.

But Anthony Wales' second touchdown of the day, a 42-yard scamper with 5:05 left, helped seal it for the Hilltoppers. Nicholas Norris hauled in touchdown passes of 69 and 55 yards in the third quarter for Western Kentucky, and Jared Dangerfield made a highlight-caliber 26-yard TD catch over three defenders to cap a 28-point third quarter for the Hilltoppers.

''Brandon is a great quarterback,'' Taggart said. ''Not only did he do it against us, he did it against everybody.''

Quinton Flowers rushed for two touchdowns and threw for another for USF (8-5), finishing with 273 yards passing and 108 more on the ground. Marlon Mack rushed for another 108 for the Bulls, who were in a bowl for the first time since 2010 and rewarded Taggart with a three-year extension through 2020 earlier in the day.

''I believe in Coach T,'' Flowers said. ''He believes in me and he believes in this team.''

USF lost for just the second time in its last nine games. The Bulls' 597 yards of offense was the program's most ever against an FBS opponent, topped only by 745 against Florida A&M in 2011.

''We came up short, but the future is bright for USF football,'' Taggart said.

Down 14-0 before finally getting on the scoreboard on Wales' touchdown run, the Hilltoppers - who put up 612 yards in a game that featured 1,209 yards of offense - seemed poised to tie the game in the second quarter after driving to the South Florida 6.

And then they punted.

That's right, they punted, after having first-and-goal.

Another year, another oddity in a bowl game for Western Kentucky. Last year the Hilltoppers won the Bahamas Bowl despite giving up five straight touchdowns to Central Michigan - including a three-lateral, 75-yarder as time expired, escaping with a 49-48 win only after the Chippewas' 2-point conversion try failed.

This year's `what-was-that?' moment for the Hilltoppers was having a 4th-and-goal from the 38. Doughty completed five consecutive passes for 69 yards on the drive, getting his team to the USF 6. A first-and-goal rush for no gain was followed by an unsportsmanlike conduct penalty, and then sacks of 7 and 10 yards on second and third down, and that led to the punt.

''We definitely do try to play an exciting brand of football,'' WKU coach Jeff Brohm said.

WKU got a field goal as the half expired to pull to 14-10, and then Doughty found Norris for the first of their two long third-quarter touchdown connections to put the Hilltoppers on top for good.

And after D'Ernest Johnson connected with Tyre McCants to get the Bulls within 24-21, Doughty helped WKU answer with a score - throwing a key block on Nacarius Fant's 9-yard double-reverse scoring run late in the third.

With USF still down 10 with 3 minutes left, Flowers overthrew A.J. Legree on fourth down from the Hilltoppers 39 and Western Kentucky could finally exhale.

''It was a great way to finish,'' Brohm said. ''We knew this would be a tough opponent ... and we knew we would have to play well. These are the type of games you want to play in.''