The phrase is the American translation of the German 'schadenfreude', which denotes actual pleasure in the suffering of another.
Me: Damn, dude. Sucks to be you.
Her: I totally blew my interview, and now you're going to get the job for sure.
Him: Ha ha! Sucks to be you!