I've heard from a few friends that not being able to sleep after playing Starcraft is not an uncommon problem. It happens most to the more intense people who really want to do well, and tend to over-analyze their losses while trying to get to sleep.
That would be me, in a nutshell.
It's fine if I win all night, or have losses that are understandable and clear, but how often does THAT happen? All it takes is some repeated stupid mistakes, or some jerk who mouths off and pushes your angry buttons, and BAM - no sleeping until 1 a.m.
So... what to do? I've often wished for a great big hammer to put the lights out at night. One whack, and I'd be down for the count. That'd be nice - except for the bruising. Drugs are right out - who wants to be addicted to sleeping pills, brought on by too much Starcraft before bed? No thanks.
My solution is a poor one - don't play past 9 pm, and don't make Starcraft 2 the last thing you play before you go to bed. If a game is bugging me, I go watch the replay until I understand what happened, so I can let it go. Alternately, do something else afterwards that requires an active brain, and at least you might be kept awake thinking about THAT, which is hopefully more productive to your life...