This one is a little bit more tricky to answer than your previous question about Temp HP from one effect canceling out any others that rely on Temp HP from another effect. (Found here: Does the Armor of Agathys spell still damage attackers if you have temp HP from another source, such as the Dark One's Blessing feature?Does the Armor of Agathys spell still damage attackers if you have temp HP from another source, such as the Dark One's Blessing feature? )
So then, you have to think in order of events. Combat happens very quickly (an entire round happens in the span of 6 seconds) and things don't really happen at once when it comes down to the rules. The creature doesn't hit you, take damage, your Armor of Agathys goes away but you gain more temp HP because the Armor of Agathys damage killed it and you reaped it's energy with Dark Ones Blessing.
It more happens like this: A creature attacks you, your Armor of Agathys is holding at 1hp , barely there anymore, 1 damage is eaten up by the barrier and the remaining 4 cleave into your shoulder (Since he broke the barrier with damage remaining we assume teh attack follows through, if only a little bit.) and the creature takes cold damage as a result of the Armor of Agathys doing it's job. It falls over, frozen and dead, and the Dark one blesses you with extra HP. After the creature dies, and after it's attack and damage is resolved.
I hope that answers your question?