LONDON -- For the past 15 years, Bob Bowman has watched Michael Phelps transform from an ornery 11-year-old into the greatest swimmer who ever lived. He's been there for all the medals, all the awards and all the nail-biting finishes. He's served as a father figure at times, teaching Phelps about life, how to drive a stick shift and how to tie a tie.

But ask Bob Bowman about when he's felt the greatest sense of pride for his pupil and the coach will now tell you the moment came on the night of Tuesday, July 31, 2012.

After a race that Phelps lost.

Michael Phelps reacts after losing the 200 fly by .05 of a second to South Africa's Chad le Clos. Ezra Shaw/Getty Images

"It was kind of heartbreaking," Bowman said through watery eyes at the end of the night.

The stage was perfectly set for Phelps heading into Tuesday night. He needed just one medal to tie and two to break the Olympic record of 18 career medals set by former Russian gymnast Larisa Latynina. He was swimming in his marquee event, the 200 butterfly, which he hadn't lost in at a major international competition in more than 12 years, and the 4x200 relay, as well.

But a funny thing happened on the way to the record. Phelps lost. He had led the 200 butterfly almost the entire race, but South Africa's Chad le Clos reached farther in the last stretch and touched the wall .05 of a second before Phelps. It was the type of race Phelps had always won, and the ultracompetitive Phelps was furious.

But he had this coming. For years, Phelps had cruised into the wall at the end of his races. And on Tuesday, in his last 200 butterfly of his career, it caught up with him.

"It came out at the moment I needed it most," Phelps would say later. "I realize that, and I'm OK with that. It's the decision I made."

U.S. teammate Davis Tarwater, who considers the 200 fly his best event and trained with Phelps for four years, disagreed. Forget the color of the medal. He called Phelps' 200 fly one of the best of his career.

"I've seen him otherworldly and struggle and everywhere in between," Tarwater said. "I just thought tonight he came out, and it was cold toughness, all grit, all heart. I saw it in his eyes. I saw it in his face. He was doing everything he could, muscling it out, trying to get the win. I can recognize that. I have so much respect for that man."

But in the first few minutes after the race, Phelps didn't see it that way. Before Phelps had accepted such failure, the look across his face was one of bitter disappointment. By the time he made the seven-minute walk to the warm-down pool, where Bowman was waiting, the look hadn't changed.

Michael Phelps now has 19 career Olympic medals, including 15 golds. Ezra Shaw/Getty Images

"He was very upset at first," Bowman said. "Not crying upset, but angry, and we just had come to grips with the fact that was that. He got in the warm-down pool and started swimming and really within about five minutes he gathered his composure and was ready to go."

From there, it was time for the medal ceremony, where le Clos waited. It was fitting, in a way, that he was the one standing atop the podium. As a 12-year-old boy, le Clos had watched Phelps swim at the 2004 Games in Athens and decided he wanted to become a swimmer. Four years later, when Phelps out-touched Milorad Cavic by one-hundredth of a second to win gold in the 100 butterfly in Beijing, it was le Clos who looked on in awe and would later put seven copies of the swim on his computer in multiple languages.

He said he is Phelps' biggest fan and beating him Tuesday night was "the greatest moment of my life."

One man's nightmare was another man's dream. Phelps could sense how excited le Clos was. And as the two stood on the podium, a smile cracked on Phelps' face. And as he and le Clos walked around the pool deck and posed for pictures, Phelps smiled more. He told the 20-year-old how to hold the gold medal when posing for pictures, and then he gave him directions on where to go after the medal parade.

As Bowman looked on, he was amazed. The younger Phelps never would have done that. He would have stewed over the bitter loss and carried it with him for weeks. But, with seemingly everything at stake, Phelps turned his emotions around with one warm-down swim.

"The way he handled that silver medal tonight, I think I'm prouder of that one than any of the other ones," Bowman said. "Just the whole thing showed how he has matured and how he understands what this entire process is all about."

An hour after his disappointment in the 200 fly, Phelps was back on the pool deck again, anchoring his team in the 4x200 free relay. He told his fellow teammates -- Ryan Lochte, Conor Dwyer and Ricky Berens -- to get him a big lead. He didn't want any sort of last-lap collapse like the team had in the 4x100 relay Sunday night.

Chad le Clos, left, said after winning the 200 fly that Michael Phelps was his hero. Kirby Lee/USA TODAY Sports

They did just that. By the time Phelps came down the pool with 25 meters to go, the outcome was certain. And for the first time in his career, Phelps said he smiled in the middle of competition.

"I knew we had done it," he said.

When he touched the wall, he spit a stream of water straight into the air. He knew. His teammates knew. Everyone knew. It was his 19th career Olympic medal.

As the night came to an end with Phelps, Lochte, Dwyer and Berens atop the medal stand after their win, Phelps apologized to his teammates. There would be no sing-along with the national anthem on this night. He knew if he tried to even mouth the words, the tears would come.

"Not even a word out," Phelps said. "My eyes were getting watery. It was emotional. A pretty cool feeling."

There are those who will say the way the events unfolded Tuesday night was less than perfect. This is Michael Phelps, after all. From what we learned in Beijing, he's supposed to win only gold. But if anything, Phelps' second-place finish in his marquee event and his failing to reach the medal podium in the 400 IM on Sunday should serve as a lesson in appreciating how hard it is to win 19 medals over a span of three Olympic Games.

"I thought the golds used to come easy," Bowman said. "Now it's like, 'Oh, please, win a medal.' It underscores how difficult it is to win a medal of any color at this event, and it's getting harder and harder. Anyone who gets any kind of medal should be highly celebrated."

Or in the case of Bowman's most famous pupil, 19 times over with the likely title of the greatest Olympian who has ever lived. At least that's what the man who beat him Tuesday night believes.

"Of course," le Clos said. "He's definitely the greatest Olympian of all time."

And how did Phelps plan on celebrating such an achievement? With three events left to swim this week -- the 100 butterfly, 200 IM and medley relay -- there wasn't much on tap for Tuesday night. Dinner, a meeting with the ice bucket and, if all goes well, some sleep. Prelims for the 200 IM were waiting Wednesday morning.

"There are still other races, and that's the one thing I have on my mind now," Phelps said. "I'm going to attempt to sleep tonight. I'm just not sure it's going to be possible."