The reasons why Holden has a panic attack after Ed hugs him are multiple.
One the one hand, the Office of Professional Responsibility has received the tape Gregg sent, which escalate the disagreement among the members of the unit. Both Wendy and Bill have reservation about the technique Holden has been using when he interviews Richard Specks. Naturally Holden feels underestimated and no one is there to get his back. Not even his girlfriend Debbie.
Holden built up his confidence by using what he learn from Kemper to successfully help the police catch the murderer. But Holden soon becomes overconfident and sometimes arrogant, and that’s not something Debbie is fond of. Debbie likes Holden as a nerdy and sensitive FBI agent, whom Holden is not at that moment. And that’s the main reason they break up.
Plus, the previous event of principle Roger is also a stress. Because the principal is dismissed there’s no way to prove if Holden’ judgement is correct or not. I guess Holden might feels guilt in a way when he saw Roger’s poor look at the supermarket and when Roger’s wife come up to accuse him of what he has done. But he is so insisted that he makes the right choice.
At the end, Holden realizes the only person that supports his perspectives is a pathetic serial killer Ed, which really makes him question the wayhe handles himself. At that specific moment, with those dissenting voice by Bill, Wendy and Shepherd hovering over Holden’s head, he just loses it.