I'm sorry to hear this. You'd be surprised how often this issue comes up - a couple gets a dog, they both fall in love with it, then they break up. If your ex is being this stubborn, and the police decline to intervene, you unfortunately only have only one remedy: the courts. A dog is considered "property" by the courts, and the only issue is who is the rightful owner. You appear to have quite a bit of evidence indicating that you have contributed more to this dog (microchip, vet bills, etc.) and a court would likely find in your favor. Probably not the "ASAP" answer you were looking for.
I would advise hiring an attorney to write a sternly worded demand letter to your ex. A letter with an attorney's letterhead and case law supporting your position may convince him to just give up the dog rather than go to court and have to hire his own attorney, etc. Also, informing him that his $5000 demand is illegal wouldn't hurt. I've handled a case similar to this before. Sorry to hear about your little pup, good luck!