Under British (specifically English) employment law, would an employer be legally allowed to fire an employee who had been having an affair with the employer's girlfriend, or would the employee be entitled to sue for unfair dismissal?
In brief, no. Article 8 of the Human Rights Act (1998) enshrines your right to a private life, and this includes having consensual sexual relationships with people you've met at work, up to and including the boss' wife (top tip, don't do this).
Everyone has the right to respect for his private and family life, his home and his correspondence.
If you're fired, you'd have a strong case for unfair dismissal on these grounds, subject to your having more than two years of service with the company.
Note that the usual provisos on being able to fire someone for "not being able to get along with another staff member" wouldn't apply in this case. The underlying cause is still their private and family life, hence the Human Rights Act would supersede that reason, in precisely the same way that you can't fire someone because they've changed their religious beliefs since you hired them.