MINNEAPOLIS (AP) Tanner Morgan was undeterred by the rough fourth quarter for Minnesota that featured 22 straight points by Indiana to tie the game.

If losing the quarterback competition in fall camp didn't faze him, this tight situation wasn't going to.

Morgan passed for 302 yards and three touchdowns in his first career start, including the tiebreaking 67-yard scoring toss to Rashod Bateman with 1:34 remaining that gave the Gophers a 38-31 victory over the Hoosiers on a rainy Friday night.

''We just continue to respond each and every time,'' Morgan said. ''Obviously in the second half there's things that we didn't do so hot, didn't do so well, but we found a way to finish.''

Morgan, a redshirt freshman who replaced injured true freshman Zack Annexstad, completed 17 of 24 attempts for the Gophers (4-4, 1-4 Big Ten).

After Peyton Ramsey capped a third fourth-quarter touchdown drive for the Hoosiers (4-5, 1-5) with a 2-point conversion pass to Donavan Hale, the teams traded punts.

When Minnesota regained possession the second time, Morgan dropped back on the first play and hit Bateman in stride after the true freshman used a double move to turn a slant pattern into a go route up the hash. Morgan had thrived on crisply thrown slants and posts all game, and Hoosiers redshirt freshman safety Juwan Burgess bit on the fake slant before watching Bateman blow by him.

''I felt good about the call, to be able to just sit there and take away what they'd hurt us on up to that point,'' Hoosiers coach Tom Allen said.

Then Ramsey lost a fumble on a sack by Carter Coughlin on the first play after that for Indiana, and Minnesota ran out the clock.

''I'm very proud of the way the guys played,'' said Gophers linebacker Blake Cashman, whose stop in the backfield of Scott on third-and-1 forced a punt right before the winning score. ''We know that in those situations we need to be able to keep our foot on the gas and finish the game out in a better way.''

Ramsey went 29 for 44 for 232 yards, two scores and two interceptions. He ran eight times for 57 yards, and Stevie Scott had 18 carries for 96 yards and a touchdown. Ramsey hit Hale for a 43-yard score and Ty Fryfogle for a 37-yard touchdown plus the 2-point conversion during the surge.

With Annexstad held out with ankle and abdominal injuries, Morgan looked like a seasoned senior while leading the Gophers on first-half touchdown drives of 77, 75 and 99 yards. Tyler Johnson caught two scoring passes and finished with 102 yards on five receptions, before departing in the fourth quarter with an injury.

''I'm really proud of this performance,'' coach P.J. Fleck said. ''Zack's not healthy. I want healthy people out there that can run our offense, and that's one reason why we didn't play him today. They're both capable.''

BROOKS IS BACK

Lost a little in the shuffle of the wild finish was the season debut for Minnesota running back Shannon Brooks, who tore his ACL in a winter workout. Brooks, who had 154 yards and a touchdown on 22 carries before hobbling off with an injury to his other leg, was about to cross the goal line again with the Gophers leading 31-9 late in the third quarter after true freshman Jordan Howden picked off Ramsey.

But Brooks lost his second fumble of the game, one of four Minnesota turnovers, and the Hoosiers recovered it at the 2. While Ramsey and Scott helped spark the Indiana rally, Morgan lost his touch over a series of six possessions that ended in three punts, two fumbles and an interception to give Indiana time to tie it.

Brooks was suspended for the previous game after an arrest on suspicion of assault that has yet to produce any charges. Fleck's plan is to limit him to four games this season to preserve his redshirt. Joining Rodney Smith, Bryce Williams and Mohamed Ibrahim, Brooks became the fourth different running back with a 100-yard game this season to set a program record.

THE TAKEAWAY

Indiana: For a program that has only one winning finish and three bowl game appearances in the last 23 years, this was simply the kind of contest they needed to win. Heck, they were even slight favorites on the road, by 2 1/2 points. Now, postseason play has become an improbable goal with a trip to fifth-ranked Michigan looming on Nov. 17 and the finale against surging rival Purdue.

''We don't have a lot of margin for error. We have to play at a fever pitch every time we take the field,'' Allen said. ''If we don't, it shows.''

Minnesota: Setting aside the sudden lapse that turned a romp into a touch-and-go finish, the Gophers emerged with an important feel-good, confidence-building win after a series of troubling performances in conference play. The remaining two victories needed for bowl-game eligibility are attainable with a trip to struggling Illinois followed by consecutive home games against Purdue and Northwestern.

''These are baby steps, infant steps, kid steps,'' Fleck said, ''but I'm really proud of the gutsy performance they had.''

UP NEXT

Indiana: Hosts Maryland on Nov. 10.

Minnesota: Plays at Illinois on Nov. 3.

---

More AP college football coverage: https://apnews.com/tag/Collegefootball and https://twitter.com/AP-Top25

Copyright 2018 by AP. Any commercial use or distribution without the express written consent of AP is strictly prohibited.