We all know that Lelouch erased Shirley's memories of him, during the Mao case. But why? Couldn't he just have erased her memories of him being Zero, instead of erasing all memories about him?
The affair with Shirley comes to a head in episode 14, when Shirley tries to shoot Lelouch after being manipulated by Mao.
Shirley fails but is still wracked by guilt, having shot Villetta Nu earlier and presumed her to be dead. In the ensuing exchange, Lelouch tries to comfort her by telling her that her actions are his responsibility. However, regardless of how seriously Shirley takes this assertion, she is still troubled by her knowledge that Lelouch was responsible for her father's death (which occurs in episode 12) and by the fact that she has a crush on Lelouch.
Lelouch then attempts to comfort her by saying, despite Shirley's protests:
Don't worry. It's time to forget all the bad things that have happened to you. [. . .] I'll help you forget all of this.
Thus, the most reasonable interpretation of Lelouch's erasure of Shirley's memory shouldn't be that it is a safety measure to ensure that no one knows that he is Zero. Rather, he is also trying to reduce Shirley's suffering, by making her forget him altogether.
That Lelouch cares for Shirley on some level, and thus, isn't just making up what he says to her, seems to be illustrated by both his reaction to the events of episode 12 and in the second season:
By his failed attempts to save the dying Shirley.
Lelouch is unaware that Viletta is on his tail because she had vague memories of him because it took him a while to successfully geass her.
Because of that he has no clue how Shirley figured out he was Zero or why she was in the harbor during episode 13.
Since he doesn't know those things he figured it would be safest to erase ALL memories relating to him, and not just the specific knowledge that he was Zero, because as far as he knew Shirley could just figure it out again, but by erasing ALL Lelouch related memories he was certain that whatever it was that put Shirley on the right path was gone.