Assume that Earnshaw's theorem is not correct and there exists a static system of $N$ entities subject to an inverse square law of force, such as
$$F=G \ m_1 m_2/d_{12}^2$$
Then since The theorem is not correct, there must be a point in the force field of these ($N$) entities where the net force vector of all of the $N$ entities is zero;
at which point one may place an entity $N+1$ having any value of the force sensitive parameter $m(n+1)$, which creates a static system of $n+1$ entities.
But since this is a static system, at any other element ($i$) we must also have zero net vector field, so any value of $m(i)$ is stable at that point.
That includes the case of $m(i) = 0$, so any element ( $i$ ) may be removed, without upsetting the equilibrium. So the system of $N-1$ entities is also stable and has a point where another entity may be placed.
This argument simply repeats, and the minimum value of ($n$) must be zero.
This is absurd, so clearly out original conjecture that Earnshaw's theorem is false, cannot be true.
The theorem comes from a general theory of orbital mechanics, where objects might be subject to any arbitrary force law, such as a $d_{12}^{-5}$ force law.
In the real classical universe outside of the atomic nucleus, there are only two known forces, and both are inverse square laws, so $m$ and $q$ are the force sensitive parameters. Inside the atomic nucleus, the strong force is not inverse square, so Earnshaw's theorem would not apply.
Of course Heisenberg would invalidate the theorem, so it is a classical result only. Magnetism is a result of moving charges, not static charges, so Earnshaw's theorem doesn't apply to magnetism.