The Illini (8-3) jumped out to a 27-11 lead early in the first half, but Hampton (4-6) made a run behind leading scorer Quinton Chievous. The senior scored eight consecutive points on a 10-0 Hampton run.
Illinois closed out the half on a strong note when Nunn drilled a buzzer-beating 3-pointer to push the lead back up to 12.
Nunn was in the starting lineup for the second consecutive game and responded with an efficient game. After missing his first two shots, Nunn made his next six, including four 3-pointers.
Dating back to last season, Nunn has reached double figures scoring in eight of 13 games when starting. In 32 games coming off the bench, Nunn has reached that plateau four times.
Rayvonte Rice added 12 points and five rebounds for Illinois.
Deron Powers and Dwight Meikle led Hampton with 12 points each, although the Pirates never led in the game. Chievous had 10. In the second half, the lead wouldn't dip into single digits as the Illini stifled the Pirates.
A midrange jumper from Meikle brought Hampton within 10 with 12:20 remaining, but the Illini hit another gear defensively on a 20-4 run over the next eight minutes.
The difference in the game came at the free-throw line. The Illini were 22-26 from the line, while Hampton was just 2 of 9.
Hampton: Entering Wednesday, when Hampton outrebounded its opponent it was undefeated. Despite 15 offensive rebounds Wednesday, the Pirates were outrebounded 38-35 and are now 0-6 when losing the rebounding battle.
Illinois: With his 3-pointer made just over three minutes into the game, Ahmad Starks has made at least one 3-pointer in every game this season. Aaron Cosby was 1 of 3 from deep, and the junior has hit a 3 in all but one game this season.
Hampton will host Tennessee State on Friday.
Illinois will face Missouri in St. Louis on Saturday.