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.
Oklahoma's offense will test Baylor's defense in crucial Big 12 battle
The PlayStation Player Impact Rating likes CeeDee Lamb and the No. 10 Sooners. Can they hand the No. 13 Bears their first loss of 2019?
Alabama's loss actually gives the SEC a better chance of two playoff teams
The Allstate Playoff Predictor shows several ways for the conference to get more than one team in the CFP, even after Bama's loss to LSU.
Answering college football's biggest non-playoff questions at Michigan, Nebraska and more
There are plenty of stories to update in Week 12, including whether Jim Harbaugh and the Wolverines can finish strong.
College football recruiting: Predicting where the nation's top prospects will sign
There are currently 57 uncommitted ESPN 300 recruits. Here is a look at some of the top prospects and predictions as to where they might be headed.
No. 21 Boise State looking to chirp vs. UNM
Boise State has experienced a bumpy three-game run that includes a loss and two closer-than-expected victories.
Army coach Jeff Monken says he never gets too emotional on Senior Day. This time might be different.