If I remember correctly, if you press the close (X) button of Yahoo Messenger, it will minimize to tray instead of exiting by default behaviour... There is also a software called Powermenu I think that is available as addon in AutoPatcher that allows you to minimize any application window to the tray...
Arun