Where does Hartshorne's proof of Grauert's theorem use integrality? Hartshorne proves Grauert's theorem (p. 288 Cor. 12.9) mainly using the semi-continuity theorem and various homological algebra lemmas scattered throughout section III.12. These assume that $f : X \to Y$ is a projective morphism of Noetherian schemes. However, Hartshorne furthermore assumes that $Y$ is integral in the statement of Grauert's theorem but does not appear to use this in the proof.
I think the fact that $Y$ be connected is important since $h^i(y, \mathscr{F})$ being constant only implies that $\dim_{k(y)} W^i \otimes k(y) + \dim_{k(y)} W^{i+1} \otimes k(y)$ is constant. However, both are upper semicontinuous so locally they must both constant. Thus if $Y$ is connected then both functions are indeed constant. However, I can't see why we need more than the connectedness of $Y$.
 A: We need $Y$ to be integral such that $\mathcal{O}_{Y,y}$ is a domain. This is used to conclude that $W^i$ is locally free from the fact that $\dim_{k(y)} W^i \otimes k(y)$ is constant. Since $W^i$ is coherent, it suffices to show that $W^i \otimes \mathcal{O}_{Y,y}$ is a free $\mathcal{O}_{Y,y}$-module of constant rank $n$. By Nakayama's lemma, we have constant rank from the constancy of $\dim_{k(y)} W^i \otimes k(y)$.
Therefore, to conclude it suffices to show that $M = W^i \otimes \mathcal{O}_{Y,y}$ is free. However, if $\mathcal{O}_{Y,y}$ this is, in general, false.
Let $A = \mathcal{O}_{Y,y}$. Since $M$ is finitely generated consider,
$$ 0 \to L \to A^n \to M \to 0$$
where we have, using Nakayma, chosen a generating set which gives a basis of $W^i \otimes k$ where $k = k(y)$ is the residue field of $A$.
When $A$ is a domain we have access to the fraction field $K$. Tensoring by $K$ gives an exact sequence,
$$ 0 \to L \otimes_A K \to K^n \to M \otimes_A K \to 0$$
but we assumed that the dimension of $M$ at the generic point is $n$ so $K^n \to M \otimes_A K$ being surjective is actually an isomorphism. This shows that $L \otimes_A K = 0$ so $L$ is torsion. However, $L \subset A^n$ is a submodule of a torsion-free module (again because $A$ is a domain) so $L$ is torsion-free. Thus $L = 0$ showing that $M = A^n$.
