Then I tried to see it from the employer's perspective... And I came to the same conclusion. It's an absolutely ridiculous stance to try to harshly punish employees for spending spare time writing code for an open source project. It's akin to firing and suing a carpenter because he used skills he developed on the job to build a nice rocking chair for the local community center.
If the project is a direct competitor to software that the employee is working on at the office, then politely sit the employee down and discuss the matter. Jumping to termination or even litigation does nothing for you:
a) You garner bad reputation and bad will in the open source community
b) You lose the respect of a former employee who is now likely to badmouth you to anyone within earshot
c) You lose an employee who was so passionate for his craft that he contributed his spare time to an open source project (it will surely be difficult to replace him/her)
d) Litigation is likely to only bring back an amount of money that is probably trivial to your company but devastating to most developers and engineers (see points a and b about generating bad will)
I can go on. As someone else said, most developers who are contributing to open source will not be deterred by such a threat. But the vast majority of developers will likely avoid any company who is known to take part in this practice.
What does the company stand to gain?