It is likely that this question could and would be answered differently by a variety of readers, but it seems to me that Hamlet is actually the moral center of William Shakespeare's Hamlet. Despite some actions which could certainly be considered immoral, Hamlet generally acts in accordance with his morals.
Though it is true that Hamlet vows to avenge his father's murder, which is certainly not an acceptable act in most people's moral codes, he does not act immediately. Instead he takes the time--perhaps too much time--to be sure that he is not, for some reason, being tricked into committing a murder by a ghost. He refuses to kill Claudius when Claudius is confessing his sins, but that may also be because he is still hesitant to actually commit murder.
Hamlet does kill Polonius, but that, of course, is an accident. If he had known it was Polonius hiding behind the tapestry, Hamlet never would have killed him. It is true that Hamlet was perfectly willing to kill Claudius, but remember that he was in a great state of agitation in his mother's room, has just been revisited by his father's ghost, and had just passed up a chance to kill Claudius. These emotions overcame him and he acted; when he learns it was Polonius, he is sorry.
In his dealings with Ophelia, it does seem as if Hamlet was acting honorably. When he begins his plan to put on his "antic disposition," he specifically tries to warn her away from him by appearing to her in a state of disarray and acting rather crazy. His clearest warning happens when he speaks to her for what turns out to be the last time:
Get thee to a nunnery: why wouldst thou be a
breeder of sinners? I am myself indifferent honest;
but yet I could accuse me of such things that it
were better my mother had not borne me: I am very
proud, revengeful, ambitious, with more offences at
my beck than I have thoughts to put them in,
imagination to give them shape, or time to act them
in. What should such fellows as I do crawling
between earth and heaven? We are arrant knaves,
all; believe none of us. Go thy ways to a nunnery.
Though his speech is confusing to her, the audience understands that he is warning her to stay away from him for her own good.
It is true that Hamlet has no qualms about sending his former friends, Rosencrantz and Guildenstern, to their deaths; undoubtedly his moral code is such that disloyalty in friendship is a punishable offense. Hamlet has no desire to hurt Laertes, despite Laertes' keen interest in doing Hamlet harm; and, while Hamlet talks harshly to his mother, he does not treat her as badly as he might, given the betrayal he feels. Finally, Hamlet does not kill himself, though he expresses his wish to do so several times, because he knows that suicide is against God's laws.
He is not perfect, to be sure, but Hamlet does seem to have a firm grasp on his own morality; despite a few glaring incidents, he follows a rather strict moral code. Gertrude's moral center is compromised because of her hasty marriage to Claudius, Claudius is certainly an immoral figure, and Ophelia's moral code is only tested once and she she fails when she commits suicide. Polonius, Rosencrantz, Guildenstern, and Fortinbras each have breaches in moral codes, as well. That leaves Horatio, who does not appear to be immoral in any way; however, he is also not tested as some of the others are.
Hamlet's morality survives some strenuous moral and emotional tests, which is why I see him as the moral center of this play.