In McCartney's recent 2 volume set called "The Lyrics", he confirms that Hey Jude was inspired by his sympathy for Julian as John was going through a divorce from his mother. Indeed, the song started as "Hey Jules".
Heroin is not mentioned in McCartney's long narrative about the lyrics to Hey Jude. As most Beatle followers know, McCartney only tried heroine once and it did not do anything for him. It would therefore seem highly unlikely that he would write an ode to heroine.