Penn State hadn't lost two consecutive games since the first two games of the 2012 season.
Christian Hackenberg threw for 339 yards and four touchdowns in the win.
The Nittany Lions kept it that way in their final contest of 2013.
Turning in its best performance of a frustrating season, Penn State pounced on No. 15 Wisconsin early then held on by its fingernails late, defeating the Badgers 31-24.
"Christian just keeps getting better," said freshman tight end Adam Breneman, who opened the scoring with a 68-yard touchdown catch. "He amazes me just like he amazes everyone else. For him to have a game like he had today to end the season, it was great."
But it was a third-down run by Zach Zwinak, who had been bottled up all day, that helped the Nittany Lions run off almost all the clock they needed. And Ryan Keiser's interception in the end zone with one second left finally sealed the deal.
Head coach Bill O'Brien said his team didn't need to look far for motivation.
"They took offense to the fact they were 24-point underdogs," O'Brien said, "and the fact that no one in State College thought they could win the game."
O'Brien relayed that spread to his players on Tuesday. They didn't like it any more than he did.
"When you're 24 point underdogs, what that tells you is no one outside your program thinks you can win," offensive lineman John Urschel said. "It's their job, it's their livelihood to make the spread the best they can."
The oddsmakers were off in this one thanks to some big plays from the Penn State passing attack. Allen Robinson had eight catches for 122 yards and Lewis grabbed three balls for 91 yards and two touchdowns, including a 59-yarder for Penn State's final score of the game. Zwinak finished with 115 yards on 22 carries, getting 61 of them on that gutsy third-down call by O'Brien.
Penn State (7-5, 4-4 Big Ten) held Wisconsin running backs Melvin Gordon and James White to a combined 147 yards. Jared Abbrederis had 12 catches for 135 yards for the Badgers but most of those yards were underneath.
The Nittany Lions' defense picked off Wisconsin quarterback Joel Stave three times, helping them overcome nine penalties and some more special teams miscues. It was a wild and satisfying end to what O'Brien again referred to after the game as an "up-and-down season."
"We had a small margin of error," O'Brien said. "More times than not we beat that margin of error."