Well, this story operates on a number of different levels, and some critics argue that it can function allegorically, especially considering the names of the characters. What is interesting in Goodman Brown's thinking about his first and last revel with the Devil is that Goodman Brown continually thinks of his good wife Faith and imagines her shock if she knew where he was and also dreams of what it would be like to be with her. Consider this quote:
And what calm sleep would be his that very night, which was to have been spent so wickedly, but so purely and sweetly now, in the arms of Faith!
To me, the biggest piece of irony in the story is that, one by one, all of the "spiritual giants" of Goodman Brown's church are shown to be in relationship with the devil, even up to and including Faith herself. Clearly Hawthorne is showing the massive hypocrisy in the midst of the Puritan elect, whilst also indicating the innate sinfulness that exists within all humanity. It is this fact that destroys Goodman Brown's hope and faith in the elect and the redeeming power of good, and he comes back from his experience a changed man:
A stern, a sad, a darkly meditative, a distrustful, if not a desperate man did he become from teh night of that fearful dream.
Goodman Brown is not able to accept the innate sinfulness that is in all of us and this denial casts a shadow on the rest of his life.
Therefore irony is used to highlight the hypocrisy of the Puritan community and also establish one of the key themes of this short story - the innate sinfulness of humanity.