Ответ:

When I met Tom, he was eating an ice-cream which he had bought at the corner of the street.