How did a stable Berejiklian regime, presiding over a boom economy, get the scare of its life and only just manage to hold on, clinging like cats to a curtain to what looks to be a tiny majority?