Montana State (3-12, 0-3 Big Sky) led 56-54 when Hansen scored the first eight points in a game-ending 16-5 run.
The Bobcats had built a 19-point lead with 8:13 left in the first half with the help of seven 3-pointers, three each by Michael Dison and Danny Robison. Dison finished with 17 points and Robison 13, but they combined for only six points in the second half when the Bobcats shot 25 percent. Stephan Holm added 14 points.
Jeffrey Solarin scored 14 points and Ben Wilson 10 for the Bengals (4-11, 1-2), who snapped a six-game losing streak. Hansen made all 17 of his free throws with the Bengals finishing 24 of 27 at the line. The Bobcats were 3 of 8.
The Bobcats dropped their seventh straight.