This may be part of the problem. Your visa may, technically, have expired. But, in actual fact, the terms of your visa have been extended, pending the outcome of your ILR application.
Also, it seems to me that this action to dismiss you could well be discriminatory - they may just be terminating your employment because they think that it is easy to justify.