I don't see a good way to apply fermat's little theorem directly; however, there is a relatively easy fix.

We need only solve this mod 3 and mod 17 and then the chinese remainder theorem gives you the unique solution mod 51.

It is much easier to solve this equation here.

Similarly You can reduce mod 17 to see what is mod 17, it is easy to note 9^2 is -4 and so so the solution is 2 mod 17.

So you just need to solve the following congruence.

Just use the CRT like I mentioned to get this solution, there is a really really obvious answer to this case by inspection, lol, but in general this is how you would do it in case you have to do something similar to this but doesn't work out quite so nice.