The Hamlet that I think of as my Hamlet – the one in the first production I was in (not yet my own performance. That will be my Hamlet but before then, this was and is the guy) said this line without the comma. He gave us the sense that thoughts and fumes were circling around in his head making trouble.
I don’t know how I feel about this comma here.
It seems to make the line a command to his brains, like he were a military sergeant commanding his thoughts to About Face.