  Local gravitational instability (LGI) is considered crucial for regulating
star formation and gas turbulence in galaxy discs, especially at high redshift.
Instability criteria usually assume infinitesimally thin discs or rely on
approximations to include the stabilising effect of the gas disc thickness. We
test a new 3D instability criterion for rotating gas discs that are vertically
stratified in an external potential. This criterion reads $Q_{\rm3D}<1$, where
$Q_{\rm3D}$ is the 3D analogue of the Toomre parameter $Q$. The advantage of
$Q_{\rm3D}$ is that it allows us to study LGI in and above the galaxy midplane
in a rigorous and self-consistent way. We apply the criterion to a sample of 44
star-forming galaxies at $0\lesssim\mathrm{z}\lesssim5$ hosting rotating discs
of cold gas. The sample is representative of galaxies on the main sequence at
$\mathrm{z}\approx 0$ and includes massive star-forming and starburst galaxies
at $1\lesssim\mathrm{z}\lesssim5$. For each galaxy, we first apply the Toomre
criterion for infinitesimally thin discs, finding 10 unstable systems. We then
obtain maps of $Q_{\rm 3D}$ from a 3D model of the gas disc derived in the
combined potential of dark matter, stars and the gas itself. According to the
3D criterion, two galaxies with $Q<1$ show no evidence of instability and the
unstable regions that are 20% smaller than those where $Q<1$. No unstable disc
is found at $0\lesssim\mathrm{z}\lesssim 1$, while $\approx 60$% of the systems
at $2\lesssim\mathrm{z}\lesssim5$ are locally unstable. In these latter, a
relatively small fraction of the total gas ($\approx 30$%) is potentially
affected by the instability. Our results disfavour LGI as the main regulator of
star formation and turbulence in moderately star-forming galaxies in the
present-day Universe. LGI likely becomes important at high redshift, but the
input by other mechanisms seems required [abridged]
