I've used Stanza on my mac but haven't tried to add a toc to anything. However since you say it works most of the time but not all it is probably something like needing 2 newines in a row and starting in column 1, and maybe having a newline right after the number. Two newlines in a row is a common this starts a new paragraph marker.

You might see what is a good Windows text editor (not word processor) and look at the file in a mode where it shows every character even the "invisible" ones like newline, tab etc. Than you can see what the difference is between ones that work and ones that don't.