When you equate kinetic and potential energy via $\frac{1}{2}mv^2=mgh$, you are implicitly assuming that the gravitational field is constant, i.e. it has constant magnitude $mg$ and is directed 'downwards'. This is a fine approximation if you confine yourself to work near the surface of the earth all the time, but that is not the case here. In this case, the magnitude of the gravitational field varies significantly and so cannot be assumed to be constant. Its magnitude is given by
$$
G\frac{mM}{r^2},
$$
where $G$ is Newton's gravitational constant, $M$ is the mass of the earth enclosed in a sphere centered at the center of the earth of radius $r$, $m$ is the mass of the stone, and $r$ is the radial distance from the center of the earth to the stone.
In this problem, $r$ will vary all the way from $0$ to the radius of the earth, and so it is clearly not an accurate approximation to assume that the gravitational force will be constant.