Some TOC templates include tables with the class "toc", (e.g. {{Deaths in month TOC}} and {{Lists_of_rail_accidents_years}}) either directly or inherited (e.g. from {{TOC top}}). These templates replace the standard TOC when it is unsuitable for some reason, and like the standard TOC get hidden when a page is seen in VE's editing surface. However, although it is not possible to directly interact with them it is possible to accidentally (and unknowingly) delete them or overwrite them with something else. TOC templates that suppress the standard TOC by using the NOTOC magic world (e.g. {{Index into List of UK Baronetcies}}) behave as normal templates.
See also my very crude sandbox test page and edit.
The templates disappearing is clearly not optimal and the inconsistent behaviour equally so. I suggest that either templates including tables with class "toc" do not get hidden and appear as normal templates (first preference) or those templates and those using NOTOC appear instead as something that can be interacted with in the same manner as templates that produce no visible output (e.g. {{Use dmy dates}}). See the top of Deaths in September 2010 for an example of an article with an invisible but interactable-with template and a template that is truly invisible.