Hi, I'd like to help you with your problem.
It sounds as if your partner is using the silent treatment as a way to control you. It is also a way for him to express his anger, which he may have a lot of. It takes a lot of self control and anger to express yourself by ignoring someone important to you, especially for days at a time.
He is also acting out his anger directly towards you with the veiled comments when he gave you the gift. It was good you told him that you would leave if he didn't stop, then you following through. It gives him less control, which is probably why he didn't speak with you for days afterwords.
You have a choice here. You can speak with him about the behavior, telling him you are interested in resolving it with him. Request he attend therapy with you and work on this issue.
You can also leave the relationship. This might be wise especially if he refuses therapy. He has an issue here and if he doesn't resolve it, you will have to live with it for as long as you chose to stay with him.
You can also stay. But as I said before, you will have to deal with his behavior. Only you can decide if you want to do this. You can continue to lay down rules such as leaving as soon as he becomes mean, but you will also have to put up with him ignoring you afterwords. It would become a cycle of behavior.
Either way you decide, it has to be a decision that is good for you and your mental health.
I hope this has helped you,
I believe that he has two different ways of expressing his anger towards you. One is the way he makes mean comments to you as he does something nice, like give you a gift. This is a more direct way of expressing his feelings since he does it to your face. The other is by ignoring you when you act in a way he doesn't like. Keeping you guessing as to what displeases him is part of the game. It is about control and anger for him.
Please let me know if you have any more questions.