Well if you "cheat" it for example by "moving the mouse" programmatically, you are effectively killing the screensaver (the result is the same: no screensaver, which I assume locks your screen). So if the screensaver/lock is enforced by somebody other than you, I don't think you should be messing around with it. Either move the mouse yourself, which means being at your computer, or let it lock the screen -- this is what is wanted, right? That you do not leave your computer unattended for longer periods of time?
I'm fairly sure your IM client can be configured to not go offline at all (unless you do it yourself), so you could start from that end. I just don't see what the problem is with your messaging app, because if you're not there, there is no point in keeping it "online" to watch for messages..you could just as well check them when you get back. I think most messaging apps today can store the messages even if you aren't running the program at all times, sort of like an answering machine.
If you insist on silently not obeying the rules, consider keyboard input as well as mouse input. An all-by-itself moving mouse cursor might be spooky, but what about a terminal that wrote some wicked (maybe random) sentence at intervals?