Singular vanishing-viscosity limits of gradient flows: The finite-dimensional case