The mass murder took place on Sunday afternoon in a village in Chai Prakarn district of Chiang Mai province.
Read: Man kills wife, two children before committing suicide in Karachi
"Five boys were killed by a mentally ill man using a chopping knife," Police Lieutenant Colonel Sombut Kalasuk from Chai Prakarn police told AFP.
"The wounds were to their necks and heads -- they were aged from five months to eight years old," he added.
Pictures widely shared on social media showed a scene of carnage, with the blood-soaked corpses of the children littering the house.
At least one of the children was related to the pregnant woman, who was taken to hospital suffering from stab wounds but survived the ordeal.
Three of the bodies were found inside the house while another was found dead next to a nearby fence. The fifth child died in hospital, police added.
Sombat did not say what caused the unidentified man to turn violent.
But he said he had previously been treated in hospital for an undisclosed mental health problem. He has since been arrested and taken to hospital.
A doctor at Suanprung Hospital in Chiang Mai confirmed that the man had recently been released after receiving treatment.
Read: US mother admits to killing three sons in past 13 months
"He had been treated here for two weeks before he went home because he felt better," said Paritat Silpakit, the hospital director.
Thailand provides universal healthcare but access can be patchy -- particularly in rural and remote areas -- while the quality of mental health services still leaves much to be desired.
"Inconsistency of medication and the distance from patients' houses to hospitals is still a challenge", Panpimol Wipulakorn, deputy general director of the Department of Mental Health, Ministry of Public Health, told AFP.
COMMENTS
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ