Stabilization of the electroweak vacuum by a scalar threshold effect