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.
ASU's Aiyuk penalized for high-fiving fans
Arizona State's Brandon Aiyuk is given an unsportsmanlike penalty for high-fiving fans after scoring a touchdown Saturday night.
Pac-12 suspends referee for penalty on wrong team in Washington State loss to California
Referee Matt Richards was suspended one game after his officiating crew awarded a penalty to the wrong team in Washington State's loss to California on Saturday.
Notre Dame DE Julian Okwara to miss rest of season with broken left fibula
Notre Dame senior defensive end Julian Okwara will miss the rest of the season after sustaining a fractured left fibula in Saturday's win at Duke.
AP poll: LSU No. 1 landslide; Gophers in top 10
LSU is an overwhelming No. 1 in The Associated Press college football poll after beating Alabama in a 1-2 matchup, and Minnesota moved into the top 10 for the first time in 57 years.
College football bowl projections
There are still many big games left on the schedule, but see how our experts envision the entire bowl season playing out.
Chad Morris firing -- What's next for Arkansas
From Gus Malzahn to Mike Leach to Mike Norvell, several coaches could be next in line to take over the Razorbacks' program.