TAMPA, Fla. (AP) — It turns out Major Applewhite was right.

His Houston Cougars had everything it took to beat previously unbeaten No. 17 South Florida on Saturday.

That included a young quarterback who didn't show his inexperience while getting his first extensive playing time in college and a defense that answered the coach's challenge to play a complete game.

D'Eriq King kept his team's hopes alive with a 30-yard completion on fourth-and-24, then finished a winning drive with his second touchdown run of the day to lift the Cougars (5-3, 3-2 American Athletic Conference) over USF 28-24 before an announced crowd of 32,316.

"Everybody doubted us, and we just came and got it," running back Mulbah Car said after King's 20-yard scramble ended the nation's longest winning streak at 12 games.

"There's no stopping us. We just stop ourselves," Car, who ran for 137 yards and a TD, added. "We beat ourselves a lot, and today we all came together."

King, who has split time between receiver and quarterback for two seasons, replaced starter Kyle Postma in the first half. He began slowly before leading three long scoring drives after halftime to help the Cougars position themselves for an upset.

Houston's defense did its part, too, yielding 462 yards but doing a good job of keeping USF out of the end zone after allowing 80 second-half point in losses to Tulsa and Memphis the previous two weeks.

"I was really proud of our defense. I challenged them. I was a raging lunatic this week in terms of finish," Applewhite said. "I'm tired of seeing 30 minutes. A lot of people can do things for 30 minutes. Can we do it for 60 minutes? The guys stepped up."

King threw a 39-yard TD pass Courtney Lark early in the second half. Car scored on a 4-yard run to make it 14-14 heading into the fourth quarter, and King finished a 75-yard march with a 3-yard TD run that made it 21-all with 6:20 remaining.

Quinton Flowers, who threw for 325 yards and scored on runs of 1 and 3 yards for USF (7-1, 4-1), did all he could to give the Bulls a chance to remain unbeaten and atop the AAC East Division standings with No. 18 UCF.

Emilio Nadelman's 30-yard field goal gave USF a 24-21 lead, but also left King with 1:46 to pull out the victory.

The sophomore's 30-yard completion to Lark, who leaped between two defenders to make the catch, prolonged the winning march after Brandon McDowell's 50-yard kickoff return gave Houston the ball near midfield.

"It wasn't just me. It was more the offensive line," King said of the winning TD. "They blocked real well, and the receivers blocked on the perimeter, so it wasn't just me. It was a good feeling, though."

King was 12 of 20 passing for 137 yards and one TD. He also accounted for 83 of Houston's 255 yards rushing, most of it in the second half.

Car set up his TD with a 46-yard run and finished with 137 yards rushing on 18 attempts.

USF, which has never won a conference championship, had won eight straight AAC games dating to last season. The Bulls are 17-4 in league play over the last three years.

"I told our team our goals are still in front of us," Bulls coach Charlie Strong said. "We've just got to go win our next three conference games and we'll get to where we need to get to."

STREAK ENDS

A week after letting a 17-point halftime lead slip away during a 42-38 home loss to Memphis, Houston gave itself a chance by playing solid defense early against a high-powered offense that had scored at least 30 points in a record 24 consecutive games.

USF failed to score at least 30 points for the first time since Nov. 7, 2015 during a 22-17 victory at East Carolina. The Bulls won 21 of 24 games during the streak.

THE TAKEAWAY

Houston: King gave the Cougars a spark offensively, and the defense rebounded after yielding 42 second-half points in last week's loss to Memphis. USF finished with 462 yards total offense, but it wasn't nearly as easy as the numbers suggest.

South Florida: The Bulls, who've won five games by at least 20 points, weren't as sharp as usual, offensively or defensively. But in their first real test of the season, they proved resilient and didn't flinch after Houston tied the score on three different occasions in the second half.

POLL IMPLICATIONS

USF slipped one spot in last week's rankings after squandering most of a 27-point lead while holding off Tulane 34-28 on the road. Sputtering against Houston probably ended any hopes the Bulls had of reaching the top 10 this season.

UP NEXT

Houston: Returns home to face East Carolina on Nov. 4.

South Florida: at Connecticut on Nov. 4.

___

More AP college football: www.collegefootball.ap.org and https://twitter.com/AP_Top25.