Extensions of the Higgs sector of the Standard Model allow for a rich cosmological history around the electroweak scale. We show that besides the possibility of strong first-order phase transitions, which have been thoroughly studied in the literature, also other important phenomena can occur, like the non-restoration of the electroweak symmetry or the existence of vacua in which the Universe becomes trapped, preventing a transition to the electroweak minimum. Focusing on the next-to-minimal two-Higgs-doublet model (N2HDM) of type II and taking into account the existing theoretical and experimental constraints, we identify the scenarios of electroweak symmetry non-restoration, vacuum trapping and first-order phase transition in the thermal history of the Universe. We analyze these phenomena and in particular their relation to each other, and discuss their connection to the predicted phenomenology of the N2HDM at the LHC. Our analysis demonstrates that the presence of a global electroweak minimum of the scalar potential at zero temperature does not guarantee that the corresponding N2HDM parameter space will be physically viable: the existence of a critical temperature at which the electroweak phase becomes the deepest minimum is not sufficient for a transition to take place, necessitating an analysis of the tunnelling probability to the electroweak minimum for a reliable prediction of the thermal history of the Universe.