Disorder, metastability, and history dependence in transformations of a vortex lattice