Racing was left acutely embarrassed when it was discovered that the Charlie McBride-trained Mandarin Princess, winner of the opening two-year-old race at Yarmouth, was in fact stablemate Millie's Kiss.
The mistake was only discovered after the 50-1 outsider had overturned the 4-6 favourite Fyre Cay in the six-furlong novice auction stakes for juveniles.
But as the weigh-in had been announced, the result was allowed to stand - for the time being.
Millie's Kiss, a three-year-old with plenty of racecourse experience, was due to run in the nine-furlong handicap later on the card but was subsequently withdrawn.
A report issued by the Yarmouth stewards read: "The stewards held an inquiry to consider the circumstances surrounding the identification of the winner, Mandarin Princess, trained by Philip (Charlie) McBride, which was presented at the sampling unit for routine testing.
"The scan identified the horse to be Millie's Kiss, the trainer's other runner in race four.
"They interviewed the trainer, the stable groom, the veterinary officer and the equine welfare integrity officer responsible for the sampling unit.
"Having heard their evidence they referred the matter to the head office of the British Horseracing Authority and ordered Millie's Kiss to be withdrawn from race four."
Stipendiary steward Tony McGlone said: "Mr McBride went over to the weighing room to collect the saddle and was slightly delayed.
"The stable girl had taken the horse out of the stables and put it in the saddling boxes. Mr McBride put the saddle on, the horse ran, it won.
"We then sent the horse for routine testing as per normal. The integrity officer scanned the horse and found it to be the wrong horse."
The British Horseracing Authority will launch an investigation and said it will "determine what steps need to be put in place to prevent it from happening again".
Racing's ruling body said in a statement: "Since we introduced the micro-chipping identification system an incident such as this is, as far as we are aware, unprecedented.
"The issue had not been established until after the result had been made official. After the weighed-in has been declared on the racecourse, the result cannot be amended by the stewards.
"The responsibility lies with the trainer to present and run the correct horse in the race.
"Having said that, and while we have not seen an incident of this nature in recent times, we will of course determine what steps need to be put in place to prevent it from happening again.
"We sympathise with the betting operators and betting public who have potentially been affected by this incident."
John Egan, who rode the 'winner', believes the stewards should have declared the race void.
He told At The Races: "At the end of the day, we're all human. Mistakes happen. I feel most sorry for Charlie."
"I'm surprised on the day the stewards didn't make the race void or disqualify the winner."
Most bookmakers paid out on the first and second horses to have crossed the line.
McBride was not available for comment when contacted by Press Association Sport.