Demi Lovato did not OD on heroin ... so says a source connected to the singer.

TMZ broke the story ... law enforcement sources involved in the case told us it was an apparent heroin overdose, but the source close to Demi says no.  

The source would not reveal what drug caused her to OD, but as we reported she was given Narcan, which is used to counter the effects of opioids.

Lovato had previously struggled with cocaine and Oxycontin addictions but had been clean for 6 years. She recently confessed she fell off the wagon