I disagree. Even if the boss found somebody else to do it, the fact that somebody had stood up and said no would make a difference. It still would provide an example to other employees. Behavior is contagious. You have more power than you think. If everyone sits back and says "I can't act ethical until we have big political and social changes", I can guarantee you that those changes will never occur. Somebody somewhere has to start the ball rolling, even at some personal cost, or nothing will ever change.
It sure would provide an example to other employees. Mike was replaced because he wouldn't write the code he was asked to write. Lesson learned: Write the code you're asked to if you want to keep your job.