The girls were pretty wild. They stayed at my house and they had bought cocaine the night before. I woke up the morning and they were still awake
I don't see the necessity of past perfect here as the night before is stated which means the night before they stayed it is crystal clear.
May be if it was bought we could think that both events took place the night before, that is the only explication I can find