The sophomore who has split time between receiver and quarterback replaced starter Kyle Postma in the first half. He began slowly before leading Houston (5-3, 3-2) on three long scoring drives to position themselves for an upset.
King threw a 39-yard TD pass Courtney Lark early in the third quarter. Mulbah Car scored on a 4-yard run to make it 14-14, and King finished a 75-yard march with a 3-yard TD 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.
Emilio Nadelman's 30-yard field goal gave USF a 24-21 lead, but also left King with 1:46 to end the nation's longest winning streak at 12 games.
The quarterback's 30-yard completion to Lark prolonged the winning march.
King finished 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.
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 led 7-0 at halftime, with help from the Cougars turning the ball over on downs at their 37 early in the second quarter.
Darius Tice ran for 18 yards on fourth-and-1 to keep the ensuing drive alive, then scored on fourth-and-goal from the 2.
Houston's defense thwarted two other threats, stopping the Bulls on downs at the Cougars 11 and 27 in the opening half.
The Associated Press contributed to this report.
Report a typo to the ABC13 staff null