We are going to prove this by reducing to the Noetherian case. By openness of flatness (see Theorem \ref{theorem-openness-flatness}) we may assume, after replacing $X$ by an open neighbourhood of $x$, that $X \to S$ is flat. We may also assume that $X$ and $S$ are affine. After possible shrinking $X$ a bit we may assume that there exists an $h \in \Gamma(X, \mathcal{O}_X)$ which maps to our given $h$. \medskip\noindent We may write $S = \Spec(A)$ and we may write $A = \colim_i A_i$ as a directed colimit of finite type $\mathbf{Z}$ algebras. Then by Algebra, Lemma \ref{algebra-lemma-flat-finite-presentation-limit-flat} or Limits, Lemmas \ref{limits-lemma-descend-finite-presentation}, \ref{limits-lemma-descend-affine-finite-presentation}, and \ref{limits-lemma-descend-finite-presentation} we can find a cartesian diagram $$ \xymatrix{ X \ar[r] \ar[d]_f & X_0 \ar[d]^{f_0} \\ S \ar[r] & S_0 } $$ with $f_0$ flat and of finite presentation, $X_0$ affine, and $S_0$ affine and Noetherian. Let $x_0 \in X_0$, resp.\ $s_0 \in S_0$ be the image of $x$, resp.\ $s$. We may also assume there exists an element $h_0 \in \Gamma(X_0, \mathcal{O}_{X_0})$ which restricts to $h$ on $X$. (If you used the algebra reference above then this is clear; if you used the references to the chapter on limits then this follows from Limits, Lemma \ref{limits-lemma-descend-finite-presentation} by thinking of $h$ as a morphism $X \to \mathbf{A}^1_S$.) Note that $\mathcal{O}_{X_s, x}$ is a localization of $\mathcal{O}_{(X_0)_{s_0}, x_0} \otimes_{\kappa(s_0)} \kappa(s)$, so that $\mathcal{O}_{(X_0)_{s_0}, x_0} \to \mathcal{O}_{X_s, x}$ is a flat local ring map, in particular faithfully flat. Hence the image $\overline{h}_0 \in \mathcal{O}_{(X_0)_{s_0}, x_0}$ is contained in $\mathfrak m_{(X_0)_{s_0}, x_0}$ and is a nonzerodivisor. We claim that after replacing $X_0$ by a principal open neighbourhood of $x_0$ the element $h_0$ is a nonzerodivisor in $B_0 = \Gamma(X_0, \mathcal{O}_{X_0})$ such that $B_0/h_0B_0$ is flat over $A_0 = \Gamma(S_0, \mathcal{O}_{S_0})$. If so then $$ 0 \to B_0 \xrightarrow{h_0} B_0 \to B_0/h_0B_0 \to 0 $$ is a short exact sequence of flat $A_0$-modules. Hence this remains exact on tensoring with $A$ (by Algebra, Lemma \ref{algebra-lemma-flat-tor-zero}) and the lemma follows. \medskip\noindent It remains to prove the claim above. The corresponding algebra statement is the following (we drop the subscript ${}_0$ here): Let $A \to B$ be a flat, finite type ring map of Noetherian rings. Let $\mathfrak q \subset B$ be a prime lying over $\mathfrak p \subset A$. Assume $h \in \mathfrak q$ maps to a nonzerodivisor in $B_{\mathfrak q}/\mathfrak p B_{\mathfrak q}$. Goal: show that after possible replacing $B$ by $B_g$ for some $g \in B$, $g \not \in \mathfrak q$ the element $h$ becomes a nonzerodivisor and $B/hB$ becomes flat over $A$. By Algebra, Lemma \ref{algebra-lemma-grothendieck} we see that $h$ is a nonzerodivisor in $B_{\mathfrak q}$ and that $B_{\mathfrak q}/hB_{\mathfrak q}$ is flat over $A$. By openness of flatness, see Algebra, Theorem \ref{algebra-theorem-openness-flatness} or Theorem \ref{theorem-openness-flatness} we see that $B/hB$ is flat over $A$ after replacing $B$ by $B_g$ for some $g \in B$, $g \not \in \mathfrak q$. Finally, let $I = \{b \in B \mid hb = 0\}$ be the annihilator of $h$. Then $IB_{\mathfrak q} = 0$ as $h$ is a nonzerodivisor in $B_{\mathfrak q}$. Also $I$ is finitely generated as $B$ is Noetherian. Hence there exists a $g \in B$, $g \not \in \mathfrak q$ such that $IB_g = 0$. After replacing $B$ by $B_g$ we see that $h$ is a nonzerodivisor.