Great Britain's men were disqualified from the 4x100m relay after finishing third but the women took bronze after the French team were disqualified.
The women finished fourth but the French were excluded after changing the baton outside the specified zone.
Dwain Chambers crossed the line third for the men but Harry Aikines-Aryeetey's change with James Ellington took place outside the designated box.
"It is heart-breaking," Aikines-Aryeetey said.
"We found out when we were walking to the medal presentation."
It was the sixth major championship out of seven that the team had failed to get the baton round properly.
Great Britain's women were second at the last changeover in their 4x100m final but Hayley Jones was out-paced by France and the United States to finish fourth.
But a British protest against the French was upheld and Dina Asher-Smith, Ashleigh Nelson, Annabelle Lewis and Jones took bronze, although the decision was made after the medal ceremony.
Asher-Smith, 17, said: "It means so much to us. I'm over the moon, it's such a shock."
Jones added: "I can't even think what to say, I'm shaking right now. We were all screaming in the corridor when we found out."
The men experienced a reversal of that situation.
With the quartet believing they had finished third in Moscow, Chambers put on a bowler hat in the raucous celebrations.
Aikines-Aryeetey even suggested in a post-race interview that the group had got their changeovers "down to a tee" in a race which Jamaica won with the United States second.
But half-an-hour after the race came confirmation that Great Britain had been disqualified.
Aikines-Aryeetey remained adamant there was no infringement.
Asked if he had any idea they would be disqualified, he added: "No. I still got the baton in his hand, it felt right. I can't imagine how close it must have been. I am wondering if there has been a counter-protest.
"I don't understand, it just doesn't feel real. I gave him the baton, I ran for my life.
"We are in the industry where this is our bread and butter. This means a lot to us and we worked so hard for this."
Chambers, 35, maintains the team can build towards next year's Commonwealth Games and European Championships despite the disappointment.
He said: "It is emotional. To be able to cross the line in third place and secure a medal, we were looking forward to getting on the podium.
"But this is sport and it is just unfortunate that we were not able to experience what these guys are experiencing on the podium.
"All we can do now is get back home, build our team spirit back up again and move on to next year."
UK Athletics performance director and acting head coach Neil Black told the BBC: "It's pretty gutting and I'm sure we all feel the same but that's the sport."