The grand situational irony of the beginning of the novel is that Michael Henchard, rather than being punished for drunkenly "selling" his wife and daughter for five guineas, has become a sober, successful, and seemingly happy man by the third chapter. This is framed in Chapter 4 as a surprise for his wife, who returns with her daughter to find him, and the reader feels the unfairness of the situation for Susan keenly:
Time, the magician, had wrought much here. Watching him, and thus thinking of past days, she became so moved that she shrank back against the jamb of the wagon-office doorway to which the steps gave access, the shadow from it conveniently hiding her features. She forgot her daughter till a touch from Elizabeth-Jane aroused her. “Have you seen him, mother?” whispered the girl. “Yes, yes,” answered her companion hastily. “I have seen him, and it is enough for me! Now I only want to go—pass away—die.”
Readers might have expected Henchard to be living in squalor and failure as a result of his addiction and the horrible act of selling his wife and daughter. When Susan discovers him to be not only thriving but sober, the ironic injustice is almost too painful for her to bear. She shrinks from it, telling her daughter it makes her want to "go—pass away—die.” Susan encounters her "former" husband in a very similar situation to when she left him, but Casterbridge and Henchard himself have both apparently been changed by "Time, the magician."
This initial ironic situation sets up the overarching irony of the rest of the book—that Henchard has become a success despite his crimes and manipulations—which is only resolved by the novel's final "punishment" of his lonely death.
In Chapter 27, Hardy uses dramatic irony to highlight the difference between Henchard's perceived reasons for his gradual social decline and the real underlying problem of his own poor character and decisions. In this moment, Henchard sits wondering if he has been cursed by someone, when the real reasons for his "monstrous loss" are actually quite obvious:
“I wonder,” he asked himself with eerie misgiving; “I wonder if it can be that somebody has been roasting a waxen image of me, or stirring an unholy brew to confound me! I don’t believe in such power; and yet—what if they should ha’ been doing it!” Even he could not admit that the perpetrator, if any, might be Farfrae. These isolated hours of superstition came to Henchard in time of moody depression, when all his practical largeness of view had oozed out of him.
This is ironic because the reader is well aware that it's actually Henchard's own jealousy and incompetence—rather than any "roasting" of a "waxen image" or "unholy brew"—that are getting in his way. The narrator tells the reader bluntly that Henchard's "eerie misgiving" is really just his denial of Farfrae's influence over his life. If "even he" cannot admit the "perpetrator" is Farfrae, it is strongly implied that he is deliberately misconstruing the reasons for his current unhappiness.
Henchard is too proud and too deep in his "moody depression" to be able to admit to himself that his hold over the people of Casterbridge is failing him. He also seems to know this, but he can't admit it to himself, as he can't admit the superiority of Farfrae's intellect or more modern techniques. He calls Farfrae a "curst cunjuror" because he prospers as a result of professional understanding that Henchard himself does not have and cannot learn. The reader, however, is aware of more of the situation and so understands the gap in knowledge that Hardy illustrates here. Hardy's narrator explores more of Henchard's psychology around these events than he is himself aware of, allowing the reader to perceive deeper levels of his character and see the limitations of his self-knowledge.