I just merged a fix into Discourse core which should resolve this issue. It should be live on Meta within an hour.
The bug depends on your scroll position in both the source and destination topic, so that might explain why it feels inconsistent to reproduce. If you were scrolled to the first post on both the source and destination topic, then the DiscoTOC display logic would be broken.