You’ve handled this with far more compassion and understanding than most people would. Since he is shy with women, it may be that he was curious and chanced looking at you to satisfy that curiosity. The fact that he initiated an apology and says he is ashamed is to his credit. On the other hand, if he makes a habit of “peeping” and only apologized because he thought you knew, he could have the much more serious problem of voyeurism. Voyeurism is a paraphilia and involves observing unsuspecting people for the purpose of sexual excitement. Often it is accompanied by masturbation – either at the time, or afterward using what was seen as stimulation. In its most severe form, peeping is the only way for the person to have sexual activity in his life.
I think your instinct to talk to him is a good one. Perhaps he will tell you whether looking at you was a lack of judgment and impulse control or if it is an indication of ongoing behavior. If the latter, he needs treatment both to help him stop an intrusive and illegal behavior and to deal with the anxieties that prevent him from finding appropriate and willing partners. His message may have been a way to ask for help. I think it’s worth a discussion.
I wish you well.