Stochastic ion heating by an electrostatic wave in a sheared magnetic field