It's a nonsense phrase used when someone is upset or sad. You pat them on the back and say "There, there." You can also say "there, there, everything will turn out right."
The word 'cork' has many senses or meanings: 1: (botany) outer tissue of bark; a protective layer of dead cells; 2: a small float usually made of cork; attached to a fishing line; 3: the plug in...