Now I am not sure why IE has that limit, unlike FireFox where you get the message after a certain period of time. In both cases I guess it would be a good idea to think of how your screen lays out data and the amount of processing it does.
In our case, it turns out that the view was being bound with around 5000 rows (not a good idea!!) of data into a grid and that caused our script to be taken as a candidate that has reached the limit of 5M statement. IE does not allow an easy way to increase this limit, the closest is changing a registry entry.
Link to the KB site http://support.microsoft.com/kb/175500