Gone with the wind: the origin of S0 galaxies in clusters