I can indeed reproduce in an XWiki instance. But strangely, I cannot in a toc macro unit test.
I don't have any problem when adding the toc macro at the beginning of the sandbox page.
What exactly is this panel that you are using ?