Thinking about this problem a little further and talking to a few users, one potential solution to this issue would be to change the tray icon action a little more significantly. My "user research" and personal experience tells me that nobody clicks on the tray icon to hide the roster; if the roster is open and they want it to go away, it is easier to simply close it directly. If we work from that, a more reasonable behavior for the tray icon might be to simply show the roster AND bring it to front on click. Further clicks wouldn't hide the roster. This way, no matter what the state of the roster is, a click in the systray presents the user with the roster on top. No confusion.
One other possibility might be: one click shows the roster (on top) and a double-click hides the roster. Right now single and double clicks are handled as the same event.
What do you think?