IOWA CITY — You could just tell from the very beginning that the Iowa basketball team wasn’t going to go away as quietly as it did the last time it played Purdue.

With about nine minutes left in the first half, the Hawkeyes’ Nicholas Baer swatted away a shot by Isaac Haas, who has seven inches and about 80 pounds on him. In the final minute of the half, freshman Cordell Pemsl forced a tie-up with the 7-foot-2, 290-pound Haas and ended up flinging him to the court, to the delight of the Iowa crowd.

There were many other similar skirmishes in the contest and even after trailing by nine points at halftime, the Hawkeyes didn’t wilt, didn’t crumble, didn’t back off.

They shot 66.7 percent from the field in the second half and responded to everything the 17th-ranked Boilermakers tossed at them in grinding out an 83-78 upset victory on Thursday night at Carver-Hawkeye Arena.

Peter Jok tossed in 29 points and added six rebounds and eight assists, and got plenty of help from Tyler Cook, Jordan Bohannon, Baer, Pemsl and even little-used Ryan Kriener as Iowa (11-7 overall, 3-2 Big Ten) avenged an 89-67 rout at the hands of Purdue just two weeks ago.

Cook added 16 points and Bohannon and Baer combined to make four free throws in the final seconds after the Hawkeyes had made just 5 of their first 14 shots at the line.

Purdue (14-4, 3-2 Big Ten) normally owns the interior against everyone it plays, but the Hawkeyes outscored the Boilers 40-20 in the paint and had a 35-28 rebound advantage over a team that crushed them on the boards in their earlier meeting.

“When you go through what we went through down there, you have to learn from it,’’ Iowa coach Fran McCaffery said. “You can’t dwell on it … You grow and then you figure it out.’’

The Hawkeyes figured a lot of things out, including how to cope with Big Ten player of the year frontrunner Caleb Swanigan. He scored 17 points but had only eight rebounds and had his string of nine straight double-doubles ended. He also missed a close-in shot that would have put his team ahead in the final minute.

Swanigan scored Purdue’s last points of the game on a 15-foot jumper to give his team a 78-77 lead with 2 minutes, 47 seconds remaining.

Cook tied the score with a free throw with 2:19 remaining and Ryan Cline, who made four very timely 3-point field goals for Purdue, then missed two free throws at the other end.

Another Cook free throw gave Iowa a 79-78 lead with 1:36 to go. After an exchange of turnovers, Swanigan missed inside and Baer tipped the rebound to Pemsl, who was fouled with 13.8 seconds remaining. He missed the free throw but the ball caromed out of bounds and was awarded to Iowa.

Officials looked at the video for several minutes to determine whether the ball was last touched by Cline or Cook, but could not see enough in the replay to reverse the call.

Bohannon, who scored 12 points, was then fouled with 11.4 seconds left and he ended the free throw drought by hitting a pair.

Dakota Mathias missed a contested 3-pointer and Baer got the rebound and was fouled. He added two more foul shots with 1.6 seconds showing on the clock.

“We got good looks,’’ Purdue coach Matt Painter said. “We didn’t execute and we put ourselves in a tough position.’’

Baer only scored four points in the game but he led both teams with 10 rebounds and played a prominent role at the defensive end in trying to limit Swanigan and Haas, who finished with 13 points.

“I was really proud of how we guarded those two collectively as a team,’’ Baer said.

He said he was just pleased with the toughness the Hawkeyes showed against arguably the Big Ten’s most physical team.

“End of the first half Cordell Pemsl wrestles up with (Haas),’’ Baer said. “Then, Ryan Kriener comes in and 45 seconds in he’s wrestling with 7-2 Isaac Haas. That’s the kind of mentality both those guys have and that we’re going to have to bring in the Big Ten, that never-back-down mentality and that fighting mentality that we had.’’

Get breaking news sent instantly to your inbox

Both teams shot at least 50 percent from the field in the first half, but Purdue went to the locker room with a 47-38 lead largely because of what it did at the free throw line. The Boilermakers made 12 of 13 foul shots in the half while Iowa was 0 for 5.

“They allowed us to have a better lead than we should have had in the first half because they missed all their free throws in the first half,’’ Painter said.

But the Hawkeyes came out firing in the second half, going on a 9-1 scoring run that was almost all Jok.

“Jok got away from us a couple of times,’’ Painter admitted. “He hit some tough shots. I guess maybe they’re not tough for him but they are for anyone else.’’

“I thought he was really special tonight,’’ McCaffery said of Jok. “We’ve seen him be special before but usually with the jump shot … He’s making it easier for everybody else, which is what you want your senior captain to do.’’

From that point on, the lead bounced back and forth. There was one especially wild sequence in which Bohannon hit a 3-point field goal to give Iowa the lead, then Cline made a three for Purdue, then Bohannon again, then Cline again.

The Hawkeyes got a huge lift from Kriener, who had not played in a game since the previous matchup with Purdue. He played eight minutes in the second half and scored six points, twice tying the score after Iowa had fallen behind.

As Kriener stood doing interviews after the game, Cook walked by and chanted “MVP, MVP.’’

“There aren’t too many guys who can come in off the bench and do what he did,’’ Cook said.