Though often illogical or unconventional, Frasier's behavior is not impossible to empathize with. He recognizes his weaknesses, so when his family and friends take advantage of them, he is reminded of both the existence of his own flaws and his loved ones' recognition of them. When people he trusts bond through making light of his flaws, their views are polarized against him and he feels increasingly helpless. His only hope is to try to mend, or at least mask, his weaknesses and prove himself to his friends and family and to himself.
In this episode, Frasier's conflict is caused by the contrast between his own wits and propriety and the immaturity of Martin, Roz, and Bulldog. Had Niles been in on the practical joking, his sensitivity probably would have prevailed in the group. But Niles was showering his maturity elsewhere that evening.