Who hired "X" employee, and why? Follow this up the chain. Follow it as far up as it needs to go, to the very email or slide deck from an upper-level exec whose failure of a pet project was greenlit to begin with. Fire the entire chain of command complicit in the lowest level employee's firing.
Truly, drain the entire swamp, otherwise the execs will keep making bad choices and playing music chairs while the boots on the ground get mutilated for them.