The merit stays even if the topic/post with the merit gets deleted.
If you check my merit history, I received 2 merits from a reply I had on this deleted post:
https://bitcointalk.org/index.php?topic=5031940.msg45873152#msg45873152While the thread is already deleted for some reason(I don't remember what the thread was about), the merits are still on my profile.