This is a question involving technicalities in contract law, consideration, human rights and property law. It is axiomatic to recognize the fact that Peter has a legal obligation not to follow Mary deliberately (and she would almost be sure of invoking such a defence), but her request for him not to stay in the same city could be viewed as way above that obligation and thus if Peter does go to the extent of moving away from the city, he could very well have given to her a practical benefit sufficient enough to effect consideration.
This however, would only be recognized by the courts as consideration if his acts fulfill the requirement of economic value. The case has since been subjected to publicity since the incursion of the Human Rights movement and the resultant policy concerns. In this question, it establishes relationship between the two parties, Peter and Mary. It is a promise or a set of promises. It is defined as "every promise or set of promises forming consideration for each other". In this case, it is a social agreement which does not create any legal obligation between them.
Hence it is not enforceable in a court of law. Thus, this case is an illegal contract. Compensation is assessed on the basis that the applicant must be put back in the position Peter would have been in if the discrimination had not been committed. Similar case quoted is Thomas v. Thomas (1842). For the relevance of property law in the arbitrary exclusion rule, read on the case of CIN Properties Ltd v. Rawlins, where a group of youths accused of misbehavior were prevented from entering upon a large part of their home centre via a court order for injunction.
If an agreement is illegal, neither party can sue the other for breach of contract nor recover for any performance rendered. If the parties are found in equal fault, the court will leave them where it found them, providing a remedy to neither. As Lord Mansfield wrote in a 1775 decision, "No Court will lend its aid to a man who founds his cause of action upon an immoral or an illegal act. " If one of the parties to an illegal agreement is ignorant of the facts making the agreement illegal, and the agreement appears to be an ordinary agreement, the courts may permit the ignorant party to sue the other for damages.
Illegality of any part of an agreement is ordinarily held to make the entire agreement void and unenforceable. However, it may be possible through terms severing the legal and illegal portions to secure partial recovery. If a contract provided for delivery of legal and illegal goods, and they were priced separately, the seller may be able to collect for the legal goods. The court may view the situation as if there were two contracts. The illegal contract would be void but the legal contract would not be void.
Conclusion The case described certainly does not radically change the common law position in relation to illegal contract. It remains the case that the courts will not enforce a contract if it was entered into for an illegal purpose, was prohibited by statute or was subsequently performed in an illegal way. As it is an illegal contract from the very beginning that the entire agreement is void and unenforceable. It is not reasonable from Peter to sue Mary for it.
Goldman, Arnold J. (1996). Business law, principles and practices / Arnold J. Goldman, William D. Sigismond. 4th ed., Boston : Houghton Mifflin Co
Beatty, Jeffrey F. (2001). Business Law for a New Century / Jeffrey F. Beatty, Susan S. Samuelson, 2nd ed., Autralis; Cincinnati, Ohio : West Legal Studies in Business / Thomson Learning.