I'm very baffled by the level of understanding of some people on here 
Even when people are trying to say it's a compliment, it still essentially means "doing better than one would expect based on their status and resources".
If you have secured a job you are not qualified for, it would be a compliment because it means you have demonstrated the necessary skills, qualities and experience despite your lack of formal qualifications in the area and others have recognised you for these. A lot people have done this and it's an achievement. A bit of a pat on the back for getting something that is technically out of their league.
When used in a romantic/sexual relationship sense, it means that the person has secured a partner they wouldn't have been expected to attract as their level of attraction, physical appearance, intelligence, income etc is lower than their partner's. I.e. Something that is technically out of their league.
In terms of a partner, it is never a compliment.
When my exh and I split up several people, including his friends, told me they were shocked that he'd had an affair as he was punching well above his weight with me. I not think they were complimenting him!