A three-year-old boy narrowly escaped serious injury when one of his fingers was stuck in a disused round lock.