I have been a work permit holder for 2.5 years but now worrying that I would lose my job soon because of a possible job cut.

In case my job would be terminated on 1st Oct, does it mean that my WP would become invalid on the same day? And how long can I still stay in the UK?
If I apply Tier 1(general) before my last day of work, and it takes 2 months to approve (by that time my WP would become invalid). Will I still satisfy the 5 years "continuous" requirement for ILR when I apply it 2.5 years later?
Hope someone can answer my questions, thanks!!