Is it possible to get a PhD in field X with research that isn't really in field X?
It is possible, usually, to work in another field on your thesis at least in the sciences. However, the thesis defense and dissertation will have to relate to the program you are in.

i.e. I had friends in physics PhD programs who worked in biology labs. The research had to be tied to physics for the dissertation and defense (light diffraction, computational modeling using physical concepts, etc.)

There will always be people who look down on specific disciplines, but I would think that usually it is acceptable if you can make it work.