Y is gone -forget about it, you shot yourself in the foot there. Stay at X whilst looking for alternative employment, which sounds feasible given your experience with Y. Forget legal avenues – even if you have a case, its far too stressful.
Why you would even contemplate staying at X in the first place is beyond me. They behave badly and you take it – perhaps you deserve each other? Maybe consider contract work if your are in the IT field – try a few things to find out that there is life outside of X!