I had the exact same problem. Googled and found a forum post somewhere with the following solution:
Turn off Galaxy S. Connect to pc by USB. Turn on Galaxy S.
Worked for me, anyway. Ever since I did that it's been working fine even if I connect it while it's turned on.
EDIT: Gah, didn't notice you had it solved already, thought the second post was from someone else. Oh well.
HTC Touch Diamond -> HTC Touch Diamond2 -> Samsung Galaxy S