History said the Gophers were cooked. They were 0-22 under Jerry Kill in games they had trailed at halftime. His offense had sputtered. His defense looked completely overmatched.

Purdue entered TCF Bank Stadium as a 13½-point underdog Saturday and steamrolled its way to an 11-point halftime lead. But Kill didn’t lay into his players with a blistering tirade.

Later, he recalled saying, “‘Hey men, this is going to define who you are. Can you fight back from adversity? You’re going to do it your whole life. And we’re going to find out what kind of team we are.’ ”

The next 30 minutes brought more adversity, more failure and more pain, but it also brought triumph, as the Gophers pulled out a 39-38 victory before a frenzied homecoming crowd of 51,241.

Freshman Ryan Santoso drilled a 52-yard field goal with 4 minutes, 59 seconds remaining, and senior Cedric Thompson bounced back from a scary fourth-quarter injury to seal the game with an interception.

The victory left the Gophers (6-1, 3-0) alone atop the Big Ten West. And it was all the sweeter for the Gophers because seemingly everyone who made a big play — from Santoso to Thompson to Mitch Leidner to David Cobb — overcame something to do it.

Cobb had 35 carries for 194 yards, but he also had a second-quarter fumble that halted the Gophers’ momentum after they took a 20-14 lead. Purdue kept making breakaway plays, and the Gophers trailed 31-20 at halftime.

“The biggest thing was not to panic and stay relaxed,” Cobb said.

Leidner completed just two of six passes in the second quarter, when the Gophers offense failed to score on its final three drives. He had just 22 passing yards at halftime, but the sophomore with the scraggly beard returned like a new man in the third quarter, throwing for 143 yards.

A key moment came with the Gophers trailing 38-29 late in the third quarter. Leidner fumbled, but the play was overturned when replays clearly showed Leidner’s knee being down before he dropped the ball.

“I knew it was down when it first happened,” Leidner said. “But I was just like, ‘Oh man, Coach Z [quarterbacks coach Jim Zebrowski] is not going to be happy with this.’ ”

Given new life on that drive, Leidner hit KJ Maye with a 37-yard touchdown pass. Maye caught the perfectly placed throw at the 10, near the sideline, and dove past a defender for the electrifying score.

By that point, the Gophers defense had overcome its hellacious start. The Gophers were tied for 15th in the nation in scoring defense, averaging 18.7 points allowed per game, but Purdue (3-5, 1-3) didn’t even have to punt in the first half.

“We just weren’t executing our plays,” Thompson said. “Some of the things they were doing, we weren’t staying true to our assignments, and that’s why Purdue got a lot of points. But in the second half, we adjusted.”

Purdue managed only one second-half touchdown. The Gophers regained control, but when their second-to-last drive stalled at the 35-yard line, Kill turned to Santoso.

The freshman had missed an extra point in the second quarter. And early in the third, Santoso got clobbered short of the goal line when Kill went for a two-point conversion via a fake kick.

This time, Santoso calmly kicked the 52-yard, go-ahead field goal with several yards to spare. But the defense still needed to hold, as Purdue’s Paul Griggs is 10-for-12 on field goals this season, including a 51-yarder.

The Gophers had Thompson back on the field after a scary moment earlier in the fourth quarter. Purdue receiver Danny Anthrop had blindsided Thompson with a personal foul, leaving the senior safety on the ground in pain.

“It was all kinds of stuff,” Thompson said. “It was my neck, it was my head, it was my stomach, it was my chest. He hit me pretty good, but once I got hit, I knew I was going to get back up. I had to get the pain settled down, and I was going to get back out there.”

Thompson had intercepted Austin Appleby’s first pass of the game and returned it to the 2-yard line, setting up a quick Cobb touchdown. And Thompson was there again, making a diving grab in front of tight end Gabe Holmes.

“I kind of trailed [Holmes]; I didn’t want anyone on top of him because then [Appleby] wouldn’t throw it,” Thompson said. “And I said, ‘If this quarterback throws this ball, it’s mine.’ ”

Moments later, the Gophers had a comeback win, bowl eligibility for the third consecutive year, their first 3-0 Big Ten start since 1990 and the prospect of landing a Top 25 ranking on Sunday.