Charlotte Dacre’s Zofloya (1806). In this early gothic novel, the (anti)heroine's servant - who later reveals himself to be Satan - enflames murderous desires in her heart by appearing to her in her dreams. The similarity may be coincidental, but there are several striking parallels between Dacre's novel and Hogg's, of which this is one.
The idea that dreams could be inspired by higher powers was not uncommon in these highly religious, pre-Freudian times. For instance, Thomas Browne writes in On Dreams (c. 1650): “That there should bee divine dreames seemes unreasonably doubted by Aristotle. That there are demonicall dreames wee have little reason to doubt”. Similarly, Thomas Tryon wrote of dreams as the medium through which both good and bad angels communicate with the dreamer in his Treatise of Dreams & Visions (1689).