Prove that if $p\equiv 1 \pmod{4}$ is a prime number and $$x\equiv \pm \left(\frac{p-1}{2}\right)! \pmod{p}$$ then $x^2\equiv -1 \pmod{p}$
I think Wilson's theorem will come in handy here, used in some clever way, but I can't see it. I would be very grateful for any help.
Using Wilson's theorem and $p \equiv 1 \pmod{4}$ gives
$$-1 \equiv (p-1)! \equiv \prod_{i=1}^{\frac{p-1}{2}}{i(p-i)} \equiv \prod_{i=1}^{\frac{p-1}{2}}{(-i^2)} \equiv (-1)^{\frac{p-1}{2}}\left[\left(\frac{p-1}{2}\right)!\right]^2 \equiv \left[\pm\left(\frac{p-1}{2}\right)!\right]^2 \pmod{p}$$