How Do Themes Get Reinstalled During An Upgrade?

I've tried several times to upgrade a CS-Cart store and every time I've had to bail out because the theme gets destroyed and I can't restore it. I've backed up the design directory before the upgrade and then, once the store is upgraded and I've confirmed that the design has been trashed I've restored the design directory and cleared all the caches (both through the admin and by manually deleting files).

The design looks fine for a second then the next refresh scrubs it. I've also tried implementing the customisations to the var/themes_repository directory and these seem to get overwritten too.

Is there a third location for themes? Like a staging area of sorts? Could someone please explain, step by step, what happens when you install a theme, apply a theme, modify a theme and upgrade the store?

Thanks.