FRESNO, Calif. (AP) -- Derek Carr threw for 460 yards and four touchdowns and led the game-winning drive that helped Fresno State avoid a fourth-quarter collapse and snap a seven-game losing streak to Boise State with a 41-40 victory on Friday night.

Josh Quezada capped a 13-play, 87-yard drive with a 1-yard run with 2:14 remaining that put the Bulldogs (3-0, 1-0 Mountain West) back ahead after they had blown a 15-point lead.

Aaron Baltazar had run for two scores and Joe Southwick added another as Boise State (2-2, 1-1) scored three touchdowns in less than 9 minutes to turn a 34-19 deficit into a 40-34 lead with just over 7 minutes remaining.

But Carr calmly completed 8 of 11 passes on the ensuing drive in front of a sellout crowd that included his older brother, David, before Quezada ran it in for the go-ahead score.

The game was sealed when Jonathan Norton broke up a pass to Kirby Moore on fourth-and-6 near midfield in the final minute setting off a long-awaited celebration.

Josh Harper caught two TD passes, Davonte Adams had another to extend his streak to 11 straight games and Quezada scored twice for the Bulldogs.

The Broncos (2-2, 1-1) have dominated the series ever since upsetting then-No. 8 Fresno State and David Carr 35-30 in 2001. Boise State had won 11 of 12 meetings coming into this game with the only loss coming in 2005. Most of the games haven't even been close with the Broncos outscoring the Bulldogs by more than 30 a game the past seven years.

But Carr did just enough to give the Bulldogs the win with help from his defense at the end.

Boise State made uncharacteristic mistakes. Southwick threw an interception deep in Fresno State territory to end a drive in the first half and Jay Ajayi lost a fumble deep in Bulldogs territory after appearing to convert a fourth-and-1 carry.

The Broncos didn't go away easily as Dallas Burroughs returned the ensuing kickoff 58 yards to set up Aaron Baltazar's 35-yard touchdown run on the next play.

Boise State held Carr and the Bulldogs on the next drive and Fresno State punted on fourth-and-1 from the Broncos 44. Boise State drove down for another score on a 2-yard run by Baltazar but failed for the second time on a 2-point conversion and trailed 34-32 with 8:28 remaining.

Fresno State then botched the ensuing pooch kick, giving Boise State the ball at the 31. Southwick almost gave the ball back when he appeared to fumble the ball out of the end zone after a long run, but the officials ruled he stepped out of bounds at the 3 just before losing the ball.

Two plays later, Southwick scored on a sneak from the 1 scored his third TD of the game and Boise got the 2-point conversion on a pass from receiver Matt Miller to Jake Hardee.

That's when Carr came through with the biggest drive of his career to win it.

Fresno State got off to a fast start, forcing a punt after the opening kick and then converting three straight third downs to take a 7-0 lead on Carr's 14-yard screen pass to Josh Quezada. That was the Bulldogs' first lead against Boise State since 2008.

That started a back-and-forth, fast-paced opening half that featured eight scores, 567 yards of offense and 97 offensive plays as Fresno State took a 24-19 lead at the break. The difference was a leaping interception by Derron Smith against Southwick to thwart a promising Broncos drive and a late sack that forced Boise State to settle for a field goal in the closing seconds of the half.