'Mary Sue' is a meaningless phrase. It has so many definitions that it is useless as a term of criticism.
It started out as a fanfiction term, to describe self-insert characters who warp the world of the story around themselves in such a way as to ruin the story. See, for example, A Trekkie's Tale, the parody fic that the term originated from. Under this definition, no character in Harry Potter can be a Mary Sue, because the series itself is not a fanfiction.
There's also an ugly side to the term. It's often used to put down any powerful female character, and is only rarely used against male characters. Along with the sneering tone of the word 'fangirls', it is used as a way to alienate female fans of a work and perpetuate patriarchal power structures.
Now, a Mary Sue in the original sense is obviously a terrible thing for a fanfiction. People want to read about Kirk and Spock's blossoming romance, not a poorly-written wish-fulfilment self-insert character outshining them both. Since the barrier of entry for fanfiction is so low, lots of really terrible writers were and are writing terrible stories starring terrible self-insert characters. As much to spoof this as to offer constructive criticism, many 'Mary Sue litmus tests' have been put out online. These list common traits that are found on Mary Sues. The test linked to in the comments is one of the less-bad ones out there, let's have a look at a few of the questions:
\3. Does your character look how you wish you look?
6. Do other characters frequently tell your character how sexy, cute, or beautiful xe is?
14. Does your character have a scar or other small "flaw" that is noticed by someone, but does not actually detract from your character's appearance from your point of view?
28. If your character has a short temper, sharp wit, snarky attitude, or is otherwise prone to verbal assaults, are the tongue-lashings and/or snarkings xe gives other characters always deserved and/or justified?
75. Is your character some kind of 'chosen one' and/or a major part of a prophecy?
80. What about any of these?
a. Born/raised in extreme poverty?
b. Born/forced into slavery?
c. Banished from anywhere?
d. A member of a despised, outcast, and/or downtrodden race or group?
e. An illegitimate child in a society where this is stigmatized?
f. The parent of an illegitimate child in a society where this is stigmatized?
g. Physically abused?
h. Sexually abused/raped?
So you see, they are broadly about 'is this character secretly a ridiculously badass and pretty version of yourself?' (note that this is a slightly different definition of the term than above, though still related). Number 80 (and there are a few others along that vein) seems like it conflicts with that overall thesis -- and it does.
Since the term Mary Sue is applied mostly to fanfictions written by awful/beginner writers, those who had the term used against them tried to change things so as to avoid the label. There's only one problem: they were and are terrible writers. Instead of understanding the core of the criticism and improving their writing, these authors would bolt a bunch of negative traits onto their character in an attempt to make them 'deep'.
So now we have yet another version of the Mary Sue.
So far I have been dealing exclusively with fanfiction, because that is where the term originated and (in my opinion) the only realm in which it is even vaguely meaningful. However, people have expanded it to apply to characters in what must (for lack of a better term) be called original fiction. It's obvious why this would be the case: as Internet communities aged, the same people who had offered criticisms of fanfiction in the past 'graduated' to applying the same lens to original fiction.
The original definition of 'unbelievably awesome/beautiful character who warps the logic of the world around them' could be applied to some original fiction. More often it is used to mean 'character I don't like'. I've seen the term applied to Superman, Batman, Doctor Who, every female companion from the Welsh series of Doctor Who, Captain Kirk, any given Little Pony, Buffy the Vampire Slayer, Indiana Jones, Lara Croft, nearly every action hero, Alyx Vance, and Ellie (from The Last of Us).
So that's yet another definition of the term.
While it's about as far from an academic source as you can get without smearing faeces on the wall, tvtropes.org is a pretty good barometer of Internet Nerd culture. Its Mary Sue page lists no fewer than fourteen distinct 'flavours' of Mary Sue, and even goes on to note even more interpretations of the meaning of the term than I have here.
- Black Hole Sue — Everything is about me!
- Purity Sue — Love me!
- God-Mode Sue — Power overwhelming!
- Mary Tzu —I knew you would do that. In fact, I knew you would do that before I even met you, cuz I'm JUST THAT GOOD!
- Jerk Sue — I'm a complete and utter bitch and I have constant PMS...love me!
- Possession Sue — My favourite character is an even better version of me!
- Copy Cat Sue — I'm just like my favorite character, but even kewler!
- Relationship Sue — You're my boyfriend now!
- Sympathetic Sue — Feel sorry for me!
- Anti-Sue — I'm genuinely useless, but everybody still loves me!
- Villain Sue — I have you now, my beautiful slaves! Ahahahahahahaha!
- Fixer Sue — No, that's not how it's supposed to go!
- Parody Sue — Why don't they fall for my buxom charms?
- Thirty Sue Pileup — We are Legion.
So at the end of this all, what do we have? The fanfiction definitions can't be applied to Harry Potter, since it isn't a fanfiction. I don't believe that any of the characters warp the logic of the world around themselves -- Yes, Harry himself is the Chosen One, has an unusual (but not truly disfiguring) scar and a tragic past (dead parents, abusive adopted family). Yes, Hermione is based on the author's personality as a child. Yes, Ginny Weasley steals my imaginary boyfriend, the bitch. But these are all fairly well-written characters; things don't go their way by authorial fiat; they have genuinely challenging obstacles to overcome. They suffer losses. They behave like human beings, and people react to them like human beings.
This question is essentially asking one of 'is Harry Potter badly written?' or 'what characters do you not like in Harry Potter?' -- neither of which strike me as a good fit for a SE site. However, since it has already been closed and re-opened, I suppose the community has spoken.