Tony Adams intercepted Wisconsin quarterback Jack Coan at midfield with 2:33 remaining. Dre Brown's tackle-breaking 13-yard run got Illinois (3-5, 1-3 Big Ten) to the Wisconsin 25 and allowed the Illini to run down the clock to attempt the game-winner.
McCourt's kick was right down the middle to give coach Lovie Smith the most significant victory of his four-year tenure in Champaign.
"Our program, we needed to get a signature win," Smith said. "I was just hoping today was the day, and the day came."
Fans rushed the field when it was over and House of Pain's "Jump Around" -- the song played prior to the fourth quarter at Wisconsin's Camp Randall Stadium -- blared over the speakers at Memorial Stadium.
The Illini closed as 30.5-point underdogs at Caesars Sportsbook. According to ESPN Stats & Info research, Illinois is the first team to win outright as more than a 30-point underdog since Iowa State (+30.5) did it against No. 3 Oklahoma on Oct. 7, 2017.
Wisconsin had not trailed this season and was looking to roll into a showdown with No. 3 Ohio State next week in Columbus. Instead, the Badgers (6-1, 4-1) blew a nine-point lead in the final 9:46 of the fourth quarter.
Illinois beat a ranked team for the first time since 2011 and knocked off a ranked Big Ten team for the first time since 2007, when the Illini beat a No. 1 Ohio State team on their way to a Rose Bowl appearance.
The Illini last beat a ranked Big Ten team at home Oct. 6, 2007 -- a 31-26 victory against No. 5 Wisconsin.
Heisman Trophy contender Jonathan Taylor rushed 28 times for 132 yards and one touchdown for Wisconsin, but he also had a fumble in Illinois territory in the fourth quarter to help fuel the Illinois comeback.
Coan was 24-of-32 passing for 264 yards and a touchdown, but his one interception came at a crucial time. His pass on third-and-5 sailed high, and Adams grabbed it to give Illinois a short field against the No. 1 defense in the nation.
"We had two drives late in the game that ended in turnovers," Wisconsin coach Paul Chryst said. "It's always hard to win on the road, and that made it even harder. We just have to move on and learn from this."
Illinois cut Wisconsin's lead to 20-14 late in the third quarter on a 43-yard touchdown run by Reggie Corbin.
Wisconsin had opportunities to pad its lead but settled for a field goal after a first-and-goal from the 3. Taylor also fumbled at the Illinois 25.
Wisconsin: Put aside the College Football Playoff implications. The Badgers' loss also twists the Big Ten West race, with No. 20 Minnesota, No. 23 Iowa and Wisconsin all yet to play each other.
Illinois: The Illini pulled off the stunner despite losing top receiver Ricky Smalling (right leg) early in the game and star defensive end Oluwole Betiku (undisclosed injury) early in the second half. Betiku ranks fourth in the nation in sacks.
Wisconsin: The Badgers head to Ohio State for a game that lost a lot of luster in Champaign.
Illinois: The Illini travel to Purdue, trying to win two straight in Big Ten play.
The Associated Press contributed to this report.
Ohio lineman lines up at WR, does a cartwheel mid-play
Ohio offensive lineman Hagen Meservy performs a cartwheel mid-play against Western Michigan.
Penn State loss means We Are! in the Bottom 10
The Nittany Lions slipped from fourth in the first College Football Playoff rankings to our even-more-coveted No. 5 spot in the Bottom 10.
How a drumline helped Florida top South Carolina
Former Florida marching band member Edward Aschoff recalls how the drumline helped Florida defeat South Carolina in 2006.
Is Nebraska football too far gone, even for Scott Frost?
The Scott Frost-Nebraska football love story strayed off script in Year 2, but the former QB and current head coach holds firm to the Tom Osborne formula that defined the once-mighty program.
Saban expects a battle vs. Mississippi State
Head coaches Nick Saban and Joe Moorhead discuss how they are expecting a physical game.
Saban not focusing on loss to LSU
Alabama head coach Nick Saban wants to focus on the games ahead and not the loss to LSU.