Suppose $X$ is a scheme, the structure morphism $X \rightarrow \mathrm{Spec}\mathbb{Z}$ smooth and surjective. Assume further that $H^0(X \times \mathrm{Spec} \mathbb{C}, \mathcal{O}^\times) = \mathbb{C}^\times$. Then is it necessary that $H^0(X, \mathcal{O}^\times) = \pm 1$ ?

$H^0(X,\mathcal O_X^\times)=\Gamma(X,\mathcal O_X)^{\times}$ since the first consists of regular functions that are everywhere locally invertible and the second consists of regular functions that are globally invertible, but these are the same thing as local inverses can be patched to global inverses. Assume the statement is false. Then $\Gamma(X,\mathcal O_X)$ must contain some unit $a$ not in $\pm 1$. That unit cannot be in $\mathbb Q$. If it were, the ring would contain $1/p$ for some $p$, which would imply that every local ring of $X$ would also contain $1/p$, so $X$ does not map surjectively onto $\textrm {Spec} \mathbb Z$ since there are no points lying over $p$. So it contains a unit not in $\mathbb Q$. Since $\mathcal O_X$, being flat, is nontorsion $\mathbb Z$module, so the map $\mathcal O_X \to \mathcal O_X\otimes \mathbb Q$ is an injection, so by left exactnes $\Gamma(X,\mathcal O_X)\in \mathbb \Gamma(X,\mathcal O_X\otimes \mathbb Q)=\Gamma(X\otimes \mathbb Q, \mathcal O_{X\otimes \mathbb Q})$. Therefore this extra unit of $\Gamma(X,\mathcal O_X)$ also lives in $X \otimes \mathbb Q$ and is not in $\mathbb Q$. By the flat base chance theorem, $\Gamma (X\otimes \mathbb C, \mathcal O_{X\otimes \mathbb C})=\Gamma(X\otimes \mathbb Q, \mathcal O_{X\otimes \mathbb Q})\otimes \mathbb C$. If you take a ring that contains $\mathbb Q[\alpha]$, with $\alpha$ a unit not in $\mathbb Q$, and tensor with $\mathbb C$ you will get a vector space over $\mathbb C$ of positive dimension, hence not $\mathbb C$. 

