I tend to think that this question is one of those basic questions that underscores the human predicament. The question of a law being just has been around as long as human beings have. From the story of Abraham and Isaac in the Bible to Sophocles' Antigone, the issue of what humans being do when the law is not just has helped to define a significant part of the human predicament. Since it is a question that has been around for so long, the answer is not an easy one.
From a practical point of view (if there can be one with such a question), the answer depends on what political situation in which an individual lives. For example, if one lives in a liberal democratic setting, there are ways to petition the government to redress an unjust law. The individual can develop their own form of resistance to a law that is unjust and be within their democratic framework of individual rights in do ing so. If one is in a political situation that does not embrace individual articulation or perception of an unjust law, sacrifices might have to be made. These could be near and dear to one's heart, but the issue of justice and the law is something in which individuals end up making a conscious effort to either accept or reject.
Such reactions have been seen throughout history. The Civil Rights Movement in American History is one such example in which the law was unjust. Leaders like Dr. King made the argument that one cannot obey an unjust law without great offense to their moral fiber. Segregation was an unjust law. When one sees injustice, Dr. King argued that one must obey a "higher" law that supersedes civil law. It is for this reason that Dr. King and so many of his followers were put in jail for their beliefs. Dr. King took his inspiration from Gandhi and the Indian Independence Movement, which essentially argued the same perspective relating to the British. With the recent disclosure of Nelson Mandela's illness, we must recall his and members of the African National Congress's efforts who saw an unjust law in Apartheid and demanded change to it. Even if this came at great sacrifice to their own person, the response was clear that when the law is not just, individuals must take action against it. Compliance with a law that is unjust is viewed in each case as acting unjust in its own right. These are but a few examples of what has historically happened when the law is unjust.