Might as well get it out of the way: Albus Dumbledore.
His sexuality is not the central part of his character, it wasn't even
mentioned in the books (if at all). What makes him well-loved is his wisdom and loyalty to his students and instructors (most of whom practically owe him their lives), as well as his eccentricity. He was the only wizard Voldemort feared and while we don't get the full details because Harry either couldn't keep up or he had passed out/was blinded, the fact he swooped in to stop Voldemort in
Order of the Phoenix was pretty bad-ass. He was not afraid of death, in fact if I remember right, he planned his death with the man he trusted the most. For fuck's sake,
his death alone is the biggest tearjerker in the entire series, he's
that loved in-story and by fans alike. Then it turns out he was the mastermind behind just about everything in the overarching plot of defeating Voldemort. It took years to accomplish, but he carefully plotted it out. That makes him the most important character in the series, and I'd daresay he's the
true hero of the story, and he's the
anti-hero. Even so, he's not perfect, he made his own mistakes and one of them proved fatal to him, but he's human.
Question remains on if you pitted him against Gandalf, who would win
(probably Gandalf), but still, Albus is fucking amazing in his own right. You could pick him apart and find more flaws, but he's one of the best characters in the series--top three, I'd wager.
Bonus round: His
My Immortal incarnation has the coolest, most quoted line in fan fiction history.
You know the one.