Let $\mathfrak q \in \Spec(S)$ be a prime. Let $\mathfrak p \subset R$ be the inverse image of $\mathfrak q$ in $R$. Note that $M_{\mathfrak q}$ is flat over $R$ if and only if it is flat over $R_{\mathfrak p}$. Let us assume that $M_{\mathfrak q}$ is flat over $R$. We claim that there exists a $g \in S$, $g \not \in \mathfrak q$ such that $M_g$ is flat over $R$. \medskip\noindent We first reduce to the case where $R$ and $S$ are of finite type over $\mathbf{Z}$. Choose a directed set $\Lambda$ and a system $(R_\lambda \to S_\lambda, M_\lambda)$ as in Lemma \ref{lemma-limit-module-finite-presentation}. Set $\mathfrak p_\lambda$ equal to the inverse image of $\mathfrak p$ in $R_\lambda$. Set $\mathfrak q_\lambda$ equal to the inverse image of $\mathfrak q$ in $S_\lambda$. Then the system $$ ((R_\lambda)_{\mathfrak p_\lambda}, (S_\lambda)_{\mathfrak q_\lambda}, (M_\lambda)_{\mathfrak q_{\lambda}}) $$ is a system as in Lemma \ref{lemma-limit-module-essentially-finite-presentation}. Hence by Lemma \ref{lemma-colimit-eventually-flat} we see that for some $\lambda$ the module $M_\lambda$ is flat over $R_\lambda$ at the prime $\mathfrak q_{\lambda}$. Suppose we can prove our claim for the system $(R_\lambda \to S_\lambda, M_\lambda, \mathfrak q_{\lambda})$. In other words, suppose that we can find a $g \in S_\lambda$, $g \not\in \mathfrak q_\lambda$ such that $(M_\lambda)_g$ is flat over $R_\lambda$. By Lemma \ref{lemma-limit-module-finite-presentation} we have $M = M_\lambda \otimes_{R_\lambda} R$ and hence also $M_g = (M_\lambda)_g \otimes_{R_\lambda} R$. Thus by Lemma \ref{lemma-flat-base-change} we deduce the claim for the system $(R \to S, M, \mathfrak q)$. \medskip\noindent At this point we may assume that $R$ and $S$ are of finite type over $\mathbf{Z}$. We may write $S$ as a quotient of a polynomial ring $R[x_1, \ldots, x_n]$. Of course, we may replace $S$ by $R[x_1, \ldots, x_n]$ and assume that $S$ is a polynomial ring over $R$. In particular we see that $R \to S$ is flat and all fibres rings $S \otimes_R \kappa(\mathfrak p)$ have global dimension $n$. \medskip\noindent Choose a resolution $F_\bullet$ of $M$ over $S$ with each $F_i$ finite free, see Lemma \ref{lemma-resolution-by-finite-free}. Let $K_n = \Ker(F_{n-1} \to F_{n-2})$. Note that $(K_n)_{\mathfrak q}$ is flat over $R$, since each $F_i$ is flat over $R$ and by assumption on $M$, see Lemma \ref{lemma-flat-ses}. In addition, the sequence $$ 0 \to K_n/\mathfrak p K_n \to F_{n-1}/ \mathfrak p F_{n-1} \to \ldots \to F_0 / \mathfrak p F_0 \to M/\mathfrak p M \to 0 $$ is exact upon localizing at $\mathfrak q$, because of vanishing of $\text{Tor}_i^{R_\mathfrak p}(\kappa(\mathfrak p), M_{\mathfrak q})$. Since the global dimension of $S_\mathfrak q/\mathfrak p S_{\mathfrak q}$ is $n$ we conclude that $K_n / \mathfrak p K_n$ localized at $\mathfrak q$ is a finite free module over $S_\mathfrak q/\mathfrak p S_{\mathfrak q}$. By Lemma \ref{lemma-free-fibre-flat-free} $(K_n)_{\mathfrak q}$ is free over $S_{\mathfrak q}$. In particular, there exists a $g \in S$, $g \not \in \mathfrak q$ such that $(K_n)_g$ is finite free over $S_g$. \medskip\noindent By Lemma \ref{lemma-exact-on-fibres-open} there exists a further localization $S_g$ such that the complex $$ 0 \to K_n \to F_{n-1} \to \ldots \to F_0 $$ is exact on {\it all fibres} of $R \to S$. By Lemma \ref{lemma-complex-exact-mod} this implies that the cokernel of $F_1 \to F_0$ is flat. This proves the theorem in the Noetherian case.