Michael Phelps seized the record for most Olympic medals in a career on Tuesday but saw his reign as king of the 200m butterfly end before anchoring the United States to a relay gold.
South Africa's Chad le Clos denied Phelps' bid for a 200m butterfly treble by a hair, but silver allowed the US superstar the consolation of matching Soviet gymnast Larisa Latynina's record of 18 Olympic medals.
Phelps returned an hour later and teamed with Ryan Lochte, Conor Dwyer and Ricky Berens to capture the 4x200m freestyle relay gold ahead of France and China, edging him one clear of Latynina with 19 medals.
"After the 400 free relay we obviously wanted to tie something together and we did it," Phelps told the BBC.
"First gold medal of the meet so I'm very happy."
Earlier, Phelps had been forced to settle for silver as he suffered his first defeat in a major 200m butterfly final for more than decade.
Le Clos, third at the final turn but clinging stubbornly to Phelps and Takeshi Matsuda, relentlessly pressed his challenge in the butterfly and plunged past Phelps at the finish to win in 1min 52.96sec.
Phelps' Olympic medals
2004: Gold: 100m/200m butterfly, 200m/400m individual medley, 4x200m
freestyle relay, 4x100m medley relay Bronze: 200m freestyle, 4x100m freestyle relay
2008: Gold: 200m freestyle, 100m butterfly, 200m butterfly, 200m/400m
individual medley, 4x100m freestyle relay, 4x200m freestyle relay, 4x100m
2012: Gold: 4x200m freestyle relay Silver: 4x100m freestyle relay, 200mfly
Phelps, who had led at every turn, was just five-hundredths of a second back in 1:53.01 and Matsuda settled for bronze in 1:53.21.
Le Clos, 20, thrust his body out of the water in delight upon seeing the scoreboard. Then he perched on a lane rope with his head in his hands as he tried to absorb his achievement in his first Olympics.
Phelps has dominated the 200m fly for a decade. He owns the four fastest times in history and his world record of 1min 51.51sec is more than one second faster than the second-best performer in history.
When he saw the result, he flipped his cap away in disappointment before heading for the side of the pool.
As he ascended the second step of the podium, Phelps looked almost sheepish acknowledging the cheers for the silver medal.
"I've had the privilege of getting to know Chad and then I've been racing with him in the last year and we've done some shoots and stuff together. He's a hard worker and he's a very talented kid," Phelps said.
"I was on the other end of that finish four years ago. I can't be too upset."
Phelps' 19 Olympic medals include a record 15 gold - eight of them from his spectacular Beijing Games campaign.
He won six gold and two bronze in the 2004 Olympics in Athens, and has won two silvers so far in London -- in Tuesday's fly and in the 4x100m freestyle relay.
Live Box 2012728143223318838
Phelps will have two more chances at an Olympic treble, in the 100m butterfly and in the 200m individual medley.
He's not the only man with a chance to achieve the feat, with Japan's Kosuke Kitajima giving himself an opportunity Tuesday as he made it safely into the final of the men's 200m breaststroke.
Phelps' training partner Allison Schmitt won the women's 200m freestyle, taking control by the halfway stage and powering home in an Olympic record of 1:53.61 ahead of France's 400m free gold medallist Camille Muffat (1:55.58) and Australian Bronte Barratt (1:55.81).
"I am speechless," said Schmitt, an unusual state for the light-hearted swimmer that Phelps has credited with making training fun again.
American Missy Franklin finished fourth, unable to add to the 100m backstroke gold and relay bronze she has already claimed in an ambitious seven-event campaign and world record-holder Federica Pellegrini of Italy was fifth.
Chinese 16-year-old Ye Shiwen shrugged off a cloud of doping speculation to complete a medley double, winning the 200m IM in an Olympic and Asian record of 2:07.57.
Ye, whose storming finish in a world record-setting 400m medley win was greeted with suspicion, set aside the controversy and held off Australian Alicia Coutts (2:08.15) and American Caitlin Leverenz (2:08.95) for the title.