Kirk Ciarrocca had seen enough. The Gophers offensive coordinator had witnessed two consecutive three-and-outs by his team in the fourth quarter, and Indiana had just rallied from a 22-point deficit to tie the score.

The Gophers got the ball back at their 33-yard line with 1:45 left, and Ciarrocca had a plan. Specifically, a play in mind.

"Coach Ciarrocca and I talked on the headset, and it wasn't getting any better on offense. Three-and out, three-and-out, three-and-out,'' Gophers coach P.J. Fleck said. "… Coach Ciarrocca said, 'Hey Coach, you mind if we end this game?'

"I said, 'I don't mind if we end this game. Whaddaya talking about? You wanna take a knee and go overtime?'''

No, the Gophers ended it right then and there.

Tanner Morgan connected with a wide-open Rashod Bateman for a 67-yard touchdown pass with 1:34 remaining, giving the Gophers a 38-31 victory over the Hoosiers in front of an announced crowd of 33,273 on Friday night at TCF Bank Stadium.

The winner came when the Hoosiers, who faced play-action slant patterns from the Gophers all evening, lost Bateman over the middle on a slant-and-go route. The true freshman hauled in the pass and reached pay dirt for the decisive play that enabled Minnesota (4-4, 1-4 Big Ten) to end a four-game losing streak and send Indiana (4-5, 1-5) to its fourth consecutive defeat.

"It was a great call,'' said Morgan, a redshirt freshman starting his first game in place of injured Zack Annexstad. "We had protection up front. [Bateman] made a great move on the guy, made a catch and did the rest. It was an absolutely elite play, elite move, elite play call.''

The touchdown put the exclamation point on an outstanding night for Morgan, who completed 17 of 24 passes for 302 yards and three touchdowns. He had a lot of help, too, as senior running back Shannon Brooks, making his 2018 debut, rushed 22 times for 154 yards and a touchdown before leaving the game in the fourth quarter because of an apparent right knee injury. Bateman caught four passes for 108 yards, and Tyler Johnson had five receptions for 102 yards and two touchdowns.

"It's amazing to see our team finish in all three areas,'' Morgan said. "We let them back in the game and at times we could have finished the game, but ultimately we found a way.''

The Gophers seemingly had everything going their way in taking a 31-9 lead when Brooks scored in a 17-yard run with 5:33 left in the fourth quarter. They had held the Hoosiers to three first-half field goals at that point and appeared ready to ease to victory.

Minnesota's offense helped its defense immensely in the first three quarters with long scoring drives that kept Indiana's offense on the sideline. The Gophers had touchdown drives of 77, 75 and 99 yards in the first half.

Indiana got the ball to start the game and marched down the field, taking a 3-0 lead on Logan Justus' 33-yard field goal. Quarterback Peyton Ramsey hurt the Gophers by scrambling for gains of 15 and 10 to convert third-down situations, but Minnesota got a stop for no gain on third-and-3 from the 15.

The Gophers quickly responded, driving 77 yards in six plays to take a 7-3 lead on Seth Green's 1-yard TD run. Morgan went 3-for-3 for 65 yards on the march, and by the end of the next drive, which gave the Gophers a 14-9 lead, he had gone 8-for-9 for 117 yards.

The results were similar in the third quarter. A 53-yard drive for a field goal took 7:06 off the clock and made it 24-9.

But Indiana took advantage of Minnesota's generosity — the Gophers committed three turnovers in the second half — and stormed back to tie the score on Ramsey's touchdown passes of 43 yards to Donovan Hale and 37 yards to Ty Fryfogle, a 3-yard TD run by Stevie Scott and a pair of two-point conversion passes.

Scott's touchdown and subsequent conversion made it 31-31 with 3:57 left, and the Gophers quickly went three-and-out. But Minnesota's defense, which had given up an average of 43.3 points in Big Ten play entering the game, stiffened, too, with senior linebacker Blake Cashman dropping Scott for a 2-yard loss on third-and-1 from the Indiana 31.

"When we're up so much, we've got to be able to put those teams away and keep our foot on the gas, and we were able to do that,'' said Cashman, who had a game-high 10 tackles, all solo.

Cashman's stop forced Indiana to punt, setting up Morgan's winning pass to Bateman. The Hoosiers, however, got the ball back with 1:34 to go. After a false-start penalty backed Indiana to its 20, Gophers rush end Carter Coughlin got a strip sack of Ramsey, and tackle Gary Moore recovered the fumble, sealing the victory.

"That play, that's a 100 percent testament to what the D line does,'' said Coughlin, the Big Ten's leader in sacks with nine. "Not me, the D line. We all work together.''

And together, they got their first Big Ten win of the season, even if there were some tense moments.

"We've got a lot to work on,'' Fleck said. "We didn't do things very well in a lot of areas, but we found a way to win. I'm really of our football team and really proud of our coaches because they deserve it.''