Actually, as a "nearshore" vendor, I can honestly tell you that your problem isn't just offshoring, per-se.
Your problem is a combination of rampant and irresponsible "offshoring sales" (i.e. companies selling services they're not really up to part to deliver based solely on price which, btw, borders on dumping), ignorant management who just eats up the "price" argument thinking they can get a mercedes benz for the price of a yugo, and their disillusionment after being conned for years by incompetent IT workers charging astronomic salaries while at the same time not being worth those salaries.
Think of it: how many times have you been in a position where you are mad that you're having to clean up some incompetent slob's IT messes and wonder why they weren't let go rapidly? If your answer is "not too often at all", then I envy you. Sadly, the truth is often the opposite case.
The combination of these morons charging an arm and a leg (comparatively speaking), and management that is less than informed is fatal: even less-than-smart managers will come to the realization that it's better to get sucky labor for cheap than do it expensively. Even worse: true-blue-idiot managers think they can actually do BETTER.
Granted - sometimes they will, but this is by far the exception, not the rule, and is such a crapshoot it ain't even funny.
Bottom line: you want to keep and protect your job? Stop worrying about keeping and protecting it, and start worrying about how you can bring more value, produce more, be more efficient, etc. In the end, if you get canned for it, then you were already on the chopping block anyway and just didn't know it.
If not, then you're much more likely to be considered a valuable resource and your cost to the organization will be more than justified.
Bottom line: when an employee's value matches or outweighs their cost to the organization, the employee is a keeper regardless. Most managers - even stupid ones - think in those terms.