I gave the imp the potion but he didnt kill frederik, he just told him he was leaving.
I then used the bloodstone to heal frederik and then he attacked me for wasting a bloodstone.
Then the quest completed.