When a competitor tried to buy Starbucks, Howard Schultz was rescued by Bill Gates Sr.

Howard Schultz, chairman and former CEO of Starbucks
Adam Jeffery | CNBC

Starbucks probably would not be what it is today without William H. Gates Sr., a lawyer and father of the Bill Gates who co-founded Microsoft. The attorney was instrumental in helping former CEO Howard Schultz buy the coffee company in 1987.

Schultz first joined Starbucks in 1982, a year after he stepped foot in the original store in Seattle. "I met the founders and over the course of a year, I persuaded them to hire me," he tells Guy Raz on an episode of NPR's podcast, "How I Built This."

After a business trip to Milan inspired Schultz to bring the Italian coffeehouse tradition to the U.S., he left Starbucks in 1983 to start his own company, Il Giornale coffeehouses.

Then, in 1987, the founder of Starbucks, Jerry Baldwin, looked to sell the six-store company for $3.8 million. Schultz was the first person to come to mind and Baldwin offered him a 90-day exclusive to raise the money.

Inspirational quotes from Starbucks CEO Howard Schultz

"I was extraordinarily excited," Schultz, who was in his early 30s at the time, tells Raz.

His excitement was short lived. Two months later, after the young entrepreneur had raised about half the funds, Baldwin called him in for a meeting. "We have a competitive buyer," the founder told Schultz. "One of your investors from Il Giornale has shown up and offered me $4 million cash with no due diligence."

"I can remember that moment as if the world had just ended," Schultz recalls. "I knew who it was. The person at the time — there were three business titans in Seattle — and he was one of them. ... I didn't know what to do."

Here's how two travelers from France made a huge deal with Starbucks

That's where Bill Gates Sr. comes in.

A couple days after Baldwin broke the news, Schultz's friend and attorney Scott Greenberg mentioned he might be able to help. He told Schultz to stop by his office the next day to meet with his firm's senior partner.

"I didn't know who the senior partner was," Schultz tells Raz. "I didn't know anything," let alone that he would be meeting with Bill Gates Sr.

Gates Sr. asked for the entire story. He then told Schultz, "We're going to take a walk."

Bill Gates and Bill Gates Sr.
Brian Ach | Getty Images

"And I said, 'Where?'" Schultz continues. "He says, 'We're going to see the man.' My heart was racing with such anxiety, trepidation. I'm not saying the name, but he's taking me to see the competitive buyer."

Ten minutes later, they arrived at the titan's office, Schultz recalls: "Now, Bill Gates Sr. is six-foot-seven, and, in the mid-80s, he was in his prime. He was a force.

"We walked in that office and all I remember him saying is: 'You should be ashamed of yourself that you're going to steal this kid's dream. It's not going to happen. You and I both know this is not going to happen.'

"Within 10 minutes, he told him to stand down, we're walking out of this office and this kid's buying this company."

Within 10 minutes, he told him to stand down, we're walking out of this office and this kid's buying this company
Howard Schultz
Former CEO of Starbucks

That's just what happened. In August 1987, Schultz bought Starbucks for $3.8 million. He served as CEO from 1987 to 2000, stepped down briefly and then returned to take the helm in 2008.

Today, thanks in part to Gates Sr., there are more than 25,000 Starbucks locations that employ more than 300,000 people. And Schultz, who stepped down again in April 2017, is a billionaire three times over.

Like this story? Like CNBC Make It on Facebook!

Don't miss: How Starbucks' Howard Schultz went from the projects to creating 300,000 jobs and a $3 billion fortune

Howard Schultz to step down as CEO of Starbucks