Proper and flat over $\mathbb{P}^1_{\mathbb{Z}}$ implies locally free Let $\pi:X\to \mathbb{P}^1_{\mathbb{Z}}$ be a proper flat morphism with $X$ an integral scheme. Is $\pi_*\mathcal{O}_X$ necessarily locally free?
 A: Like your other question, the answer to this one is related to miracle flatness:
Theorem (Miracle flatness). Let $f \colon X \to Y$ be a finite dominant morphism of schemes with $Y$ regular. Then $f$ is flat if and only if $X$ is Cohen–Macaulay.
See for example Tags 00R4 and 00R5.
Now let $f \colon X \to Y$ be flat and proper, with $Y$ regular of dimension $2$. Let $X \to Y' \to Y$ be the Stein factorisation, so $Y'$ is the normalisation of $Y$ in $X$ (see Tag 03H0). Here is a positive result:
Claim. If $X$ is normal, then $f_* \mathcal O_X$ is locally free.
Indeed, if $X$ is normal, then so is $Y'$, hence it is $S_2$ by Serre's criterion (Tag 031S). Since it is finite (dominant) over $Y$, it has dimension $2$, so $S_2$ is equivalent to Cohen–Macaulay. Then miracle flatness says that $Y' \to X$ is flat. $\square$
Conversely, if we assume a priori that $f$ is finite, then $X = Y'$, which is $S_2$ if and only if it is Cohen–Macaulay if and only if it is flat over $Y$. So it suffices to construct a finite map $X \to \mathbf P^1_{\mathbf Z}$ with $X$ not $S_2$.
There are many ways to do this. One construction is to take a double cover $\mathbf P^1_{\mathbf Z} \to \mathbf P^1_{\mathbf Z}$ by $[x:y] \mapsto [x^2:y^2]$, and glueing together the points $[1:0]$ and $[-1:0]$ in the fibre above $3 \in \operatorname{Spec} \mathbf Z$ of the source $\mathbf P^1_{\mathbf Z}$ (which map to the same point in the target). The resulting scheme is regular in codimension $1$ but not normal, so cannot be $S_2$. (See also this answer for glueing schemes along closed subschemes.)
