Yes, held the Supreme Court in Hounga v Allen.
At common law a court will not normally enforce a contract where the basis of its performance results in an unlawful or illegal act - otherwise known as illegality of contract.
Miss Hounga, a Nigerian national, arrived in the UK in January 2007 having falsely obtained a visitors visa. She had no right to work in the UK and, after July 2007, no right to remain. However, she was employed by Mrs Allen as a live in nanny and lived in the Allen household. Hounga was mistreated by Allen and, in July 2008, Allen evicted Hounga from the household, effectively dismissing her from employment.
Hounga succeeded in a claim against Ms Allen for unlawful discrimination in relation to the dismissal which was subsequently upheld by the EAT. However the Court of Appeal upheld an appeal by Allen accepting that the illegality of the contract formed a material part of Hounga's complaint and to uphold it would condone illegality. Hounga appealed.
The Supreme Court upheld the appeal as they said there was an insufficiently close connection between Hounga's immigration offences and her claim for discrimination as the former merely provided the setting or context in which that tort was committed.