Is it immoral to obey a law that you consider to be immoral?
Yes, of course! It is highly immoral, but not obeying it would be highly irrational. But then again, all morality is irrational. You can either be moral or rational - pick one. Exchanging your own happiness for morality is the epitome of irrationality, but some people enjoy it very much.