While it is true that
How could you...! expresses disbelief or surprise, it is often used in a critical way and can be accompanied by emotions of anger. For example, imagine that you told your friend something very private but then he told other people without your permission. You might say to him:
"How could you have done that!". You are shocked and in disbelief that he would do something so bad, and you are angry at him.
In your example, you need a phrase that expresses surprise but doesn't include the negative emotions of
How could you. Something like
How did you manage that! or even
How did you do that! (used ironically) would work better, in my opinion.