The win snapped a two-game losing streak for the Knights, which were playing their first game at home since Nov. 17.
Brandon Goodwin added 11 points and 11 rebounds off the bench for UCF.
The Knights led by just five at halftime, but used a 14-0 run midway through the second half to take control of the game.
There were 47 fouls in the game, but both teams struggled from the free throw line. UCF shot just 55 percent and Stetson 50 percent.
The Knights had just four fast-break points in the first half, but started to get out and run in the second half, which began to spread the Hatters out defensively.
UCF finished with just 10 fast-break points for the game, but had eight of those the final 20 minutes.
UCF led by as many as 13 points in the first half, but struggled to keep a scrappy Hatters team from getting in the paint, and led just 39-34 at halftime.
Stetson was within 13-12 early before a 19-7 Knights spurt gave them a 32-19 cushion.
But the Hatters got a combined 21 first-half points out of Graham and Andrews, who sparked an 11-3 run to get them back into the game.
It could have been closer, but Stetson went just 6 of 12 from the foul line in the opening 20 minutes.
UCF wasn't much better, though, connecting on only 9 of its 15 free-throw attempts in the half.
Mississippi State freshman guard Malik Newman will withdraw from the NBA draft, but sources told ESPN he might explore other opportunities besides returning to Mississippi State.
Seton Hall sophomore Isaiah Whitehead will stay in the NBA draft and not return for his junior season.
Washington State's trio of Josh Hawkinson, Conor Clifford and Ike Iroegbu have withdrawn from the NBA draft and will play their senior season with the Cougars.