Shape transitions of metastable surface nanostructures