Phase separation is a cooperative process, the kinetics of which underpin the orderly morphogenesis of domain patterns on mesoscopic scales1,2. Systems of highly degenerate frozen states may exhibit the rare and counterintuitive inverse-symmetry-breaking phenomenon3. Proposed a century ago4, inverse transitions have been found experimentally in disparate materials, ranging from polymeric and colloidal compounds to high-transition-temperature superconductors, proteins, ultrathin magnetic films, liquid crystals and metallic alloys5,6, with the notable exception of ferroelectric oxides, despite extensive theoretical and experimental work on the latter. Here we show that following a subcritical quench, the non-equilibrium self-assembly of ferroelectric domains in ultrathin films of Pb(Zr 0.4 Ti 0.6 )O 3 results in a maze, or labyrinthine pattern, featuring meandering stripe domains. Furthermore, upon increasing the temperature, this highly degenerate labyrinthine phase undergoes an inverse transition whereby it transforms into the less-symmetric parallel-stripe domain structure, before the onset of paraelectricity at higher temperatures. We find that this phase sequence can be ascribed to an enhanced entropic contribution of domain walls, and that domain straightening and coarsening is predominantly driven by the relaxation and diffusion of topological defects. Computational modelling and experimental observation of the inverse dipolar transition in BiFeO 3 suggest the universality of the phenomenon in ferroelectric oxides. The multitude of self-patterned states and the various topological defects that they embody may be used beyond current domain and domain-wall-based7 technologies by enabling fundamentally new design principles and topologically enhanced functionalities within ferroelectric films.