The 44-year-old father had already ushered his daughter Luljeta onto the train in Goslar, near Hannover, before turning around to attend to his luggage and his other daughter.
But at that moment the doors closed and carried Luljeta off along the tracks.
While the father phoned the police immediately, who alerted conductors on the train, a passenger had already taken the little girl under her wing, a police spokesman said.
The child was able to speak with her father on the phone and calm down before the police picked her up at Hildesheim and took her to the police station.
She was kept happy with drinks and left-over sweets from Christmas while waiting for her father to arrive in a taxi.
SEE ALSO: Hundreds stranded on faulty ICE train