The Hoosiers (13-7, 3-4) ended a two-game losing streak to split the season series.
Illinois (13-8, 2-6) was led by Rayvonte Rice with 20 but lost its sixth straight. The Fighting Illini have not won since Jan. 4, and this one prevented them from taking their first lead in the Indiana series since 1975.
It was a tough day for the offenses as both teams tried to fight their way back into the conference title hunt.
The poor shooting led to an up-and-down, low-scoring game in which neither team could fully seize control until late.
Indiana led 40-29, with 12:58 to go, but Illinois went on a 10-2 run to get within 42-39. The Hoosiers then scored six straight and sealed it with six free throws in the final minute.
The difference was Ferrell, whose impact in the first half was mitigated by Indiana's poor shooting.
But after going just 0 for 2 from the field in the first half, Ferrell turned the game midway through the second half.
Indiana, which led almost the entire first half, suddenly found itself trailing after the Illini scrambled to gain control of a loose ball and swung to a wide open Jon Ekey for a 3-pointer that made it 29-28 with 17:37 left.
That's when the Ferrell show kicked into high gear.
He hit a 10-foot runner, a 17-foot jumper and split a double team with a nifty crossover move to score on a layup. After that, he drove and dished to Will Sheehey for an open 3, and ended the 12-0 run with his own 3 to give Indiana its biggest lead of the game, 40-29, with 12:58 to go.
Illinois was far from finished.
The Illini quickly answered with a 10-2 run to get within 42-39 at the 8:24 mark.
But the Hoosiers scored six straight to make it 48-39 and the Illini spent the rest of the game playing catch-up. They never got closer than six, and Ferrell, fittingly, sealed it by going six of six from the free throw line and stealing the ball on Illinois' last possession to seal it.
Stanford Robinson finished with 10 points for Indiana.