The openly gay star, who is engaged to singer/songwriter Linda Perry, is also one of the five co-hosts on The Talk, and on Thursday during "secret week" she shared her story with the audience and her co-hosts.
"I thought he was super cute and I had a total crush on him," the 38-year-old star said of Galecki. "And we started dating and he would come over and we would, like, make out, and then I would start to get depressed."
Gilbert eventually came out to Galecki, who was "super sweet about it".
"I started dating a woman who was like 18 years older than I was, who was also in the public eye. It was something people could have found out about. Like no one knew at the show for years, and Johnny held the secret the whole time," Gilbert said.
The star also said she feared for her career if the secret got out and worried that she'd never work again.
But to this day Galecki has stood by her side. Gilbert said she called him to let him know she wanted to share the story, and the Big Bang Theory star couldn't have been more supportive.
"(He said) 'Of course. I love you and I think it's really important and I'm so proud of you... If you want, I will be there and I will hold your hand.' It was so sweet, and this story really makes Johnny look good...
"I want people to know there can still be a struggle with it and that's OK. It's a process and there can be a part of you that doesn't want to feel different or feel scared."
Gilbert's story followed revelations from Sharon Osbourne, who revealed that she had a fling with Jay Leno, Aisha Tyler, who shared her fertility struggles, and Julie Chen, who confessed to having plastic surgery -- something she was virtually forced to do to further her career in journalism.