Let $\mathcal{O}$ be a sheaf of commutative rings on a topological space $X$.
Let a point $x \in X$ and a global section $f \in \mathcal{O}(X)$ be given.
Suppose that for every open $U \subset X$ with $U \ni x$ we have that $\mathrm{res}|^X_U(f)$ is invertible (a unit) in the comm ring $\mathcal{O}(U)$.
Then, does it hold that the germ of $f$ at $x$ is invertible in the stalk $\mathcal{O}_x$?
I guess a related question (but a stronger result) would be: is the set-of-invertible-elements functor $\mathrm{CommRings} \rightarrow \mathrm{Set}$ a co-continuous functor?
Edit: as has been pointed out below, actually $f$ only needs to be invertible in at least one neighborhood $U$ of $x$, after which $f$ is then invertible in every open subset of $U$ since ring homomorphisms preserve invertible elements.
Thank you also to the very thorough answer below which explained how to get down to the level of stalks.
Yes.
Since ring homomorphisms preserve inverses, we see that if $fg = 1$ on $U$, then for each $V \subseteq U$ we have $(f \upharpoonright_V)(g \upharpoonright_V) = 1$ on $V$. It's not hard to show that this means $f_x g_x = 1$ in the stalk at $x$ by using the rule that we can compute products in the stalk by $[(f,V_1)] \ [(g,V_2)] = [(fg, V_1 \cap V_2)]$.
Another way to see this (which I mention mainly for cultural growth) is by using the internal language of the sheaf topos $\text{Sh}(X)$.
Indeed a sheaf of rings is "just" a ring object in this topos, and since $\top \vdash \exists! g . fg = 1$ is a geometric sequent, theorems in categorical logic immediately tell us that the following are equivalent:
For more information, see Ingo Belchschmidt's (excellent) PhD thesis here. In fact, this is an example given in chapter $1$.
I hope this helps ^_^