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.
Gamecocks QB Ryan Hilinski to have left knee surgery
South Carolina starting quarterback Ryan Hilinski will have surgery to repair a torn meniscus in his left knee and is expected to be fully healthy when the Gamecocks start offseason workouts next month.
Buffaloes WR Laviska Shenault Jr. declares for NFL draft
Colorado wide receiver Laviska Shenault Jr., ranked as the No. 12 overall prospect by ESPN's Mel Kiper Jr., declared for the NFL draft on Tuesday. Shenault is Kiper's No. 3 wide receiver.
Washington's Chris Petersen says anxiety, stress led to decision to step down
Chris Petersen is stepping down as coach at Washington because "a lot of frustration and anxiety and stress" has overcome the "positivity and optimism" of the job.
Auburn lands No. 2 recruit in Alabama, DT Lee Hunter
Lee Hunter, a 2021 ESPN Junior 300 defensive tackle, announced his commitment to Auburn.
Iowa State gives Matt Campbell extension through 2025
Iowa State locked in Matt Campbell through 2025. He had been mentioned as a candidate for Florida State and Arkansas jobs.
Jacksonville University discontinues football program
Jacksonville University, which has participated in the non-scholarship Pioneer Football League since 1998, has decided to discontinue its football program.