Little Declan Hainey's mummified body had beetles and three different types of flies on it when it was found in March 2010.
He had lain dead in his litter-filled cot at the rubbish-strewn flat he shared with his mum in Paisley for months.
His heroin addict mum Kimberley, 39, was jailed for murder after being found guilty of neglecting and murdering him.
But she was released last April on appeal, prompting a Fatal Accident Inquiry to be called in order to establish how Declan died.
The gruesome details emerged yesterday as the inquiry heard from a doctor who had performed a post mortem examination
Dr John Manlove said he examined Declan's body on April 1, 2010 - the day after he'd been found dead.
The entomologist, who specialises in estimating how long someone has been dead from examining insects at the scene, carried out his investigation at the flat and Yorkhill hospital.
When asked by procurator fiscal Stuart Cassidy what Dr Manlove could conclude, Dr Manlove said he thought it indicated Declan had been dead for at least four months, if not longer.
Dr Manlove explained that all the insects that were found had died, which indicated Declan's body had been there for some time.
The inquiry continues