Prior discipline or different facts can justify the occasional exception. A desire to more strictly enforce a rule going forward is also legitimate. Just make sure that you can explain why a particular employee was punished when others were not.
Recent case: Jimmy was fired from his retail job for taking a bag of cough drops from a shelf, opening it and placing it behind the cash register without paying. The store had a rule against workers consuming merchandise before paying for it or setting it aside for later purchase.
Jimmy sued, alleging the employer had no “just cause” for firing him, partly because he said other workers had committed the same infraction without losing their jobs.
However, Jimmy could offer no evidence that others had broken the same rule and gotten away with it. His lawsuit was dismissed. (Kuang v. Bel Air Mart, No. 2:15-00160, ED CA 2016)
Final note: Employees can’t just cry “No fair!” and win. They have to show that their employer treated them differently than other employees, usually because of discrimination.