When little Finlay Benzie was rushed to hospital fighting for breath, doctors thought he had something stuck in his windpipe.
As his condition deteriorated they quickly realised he was having a severe asthma attack - and that normal treatments were having no effect.
But medics were able to bring the two-year-old back from the brink of death - with the help of a drug usually used on horses.
And yesterday his mother, Ashley, said Finlay had been saved by ketamine, which is most widely known as a tranquiliser used by vets on horses.
She said: 'The doctors said Finlay was one of the youngest they had used it on and only the second to be given it for what was wrong with him - and they lost the other person. I thought we would lose him.'
Finlay, from Turriff, Aberdeenshire, had just celebrated his second birthday when he suffered the attack. Until that point, his parents had no idea he was asthmatic.
The day before, he had been splashing around in a paddling pool like any other healthy toddler.
Less than 24 hours later Finlay was fighting for life in the high dependency unit at the Royal Aberdeen Children's Hospital.
Doctors battled to save him with a cocktail of drugs, including ketamine - which in humans can help open the airways.
Mrs Benzie, 31, said: 'They just kept pumping him full of more and more drugs. At one point he had seven infusions going at once just to find out what was wrong.
'He kept getting worse. His body was shutting down because it couldn't cope.
'It was absolutely horrific. I was scared to leave him for even a moment because I didn't know what was going to happen. I felt terrible for my husband, Nick, because every time he came into the hospital he didn't know what he was going to see. It was our worst nightmare.'
After a week of further treatment Finlay, now three, finally began to show signs of recovery.
And, incredibly, just days after battling back from the brink of death, he was allowed home with his parents and brothers Jamie, seven, and Jack, 16 months.
Finlay still has check-ups every four months and has to use steroid inhalers morning and night to keep his asthma in check.
Described by his mother as 'a wee bruiser' he recently took part in a major study at the hospital to help improve the diagnosis of asthma in young children.
Mr Benzie, a 36-year-old offshore driller, said: 'We were so close to losing him. It just shows you how serious a condition asthma can be.
'But looking at him now he's full of life and he's got a great personality. He's just an angel."