Transition metal oxides (TMOs) are complex electronic systems which exhibit a multitude of collective phenomena. Two archetypal examples are VO2 and NdNiO3, which undergo a metal-insulator phase-transition (MIT), the origin of which is still under debate. Here we report the discovery of a memory effect in both systems, manifest through an increase of resistance at a specific temperature, which is set by reversing the temperature-ramp from heating to cooling during the MIT. The characteristics of this ramp-reversal memory effect do not coincide with any previously reported history or memory effects in manganites, electron-glass or magnetic systems. From a broad range of experimental features, supported by theoretical modelling, we find that the main ingredients for the effect to arise are the spatial phase-separation of metallic and insulating regions during the MIT and the coupling of lattice strain to the local critical temperature of the phase transition. We conclude that the emergent memory effect originates from phase boundaries at the reversal-temperature leaving `scars` in the underlying lattice structure, giving rise to a local increase in the transition temperature. The universality and robustness of the effect shed new light on the MIT in complex oxides.