the P-51H, why they ceased production after 500 airframes, is beyond me
Because by that time the F-80 was already clearly in the pipeline. There is no way a piston aircraft will compete with a jet-powered one. The only reason why the F-82 even survived at all was because range was the sole area where that didn't hold up (and even then the F-82 certainly didn't survive long, with or without it being unusual at best and an abomination for those less kindly inclined).
BTW, some fun facts (IIRC) - the F-82 prototype was created by joining two lengthened YP-51F frames with a common wing section. The YP-51F was the first serious effort at creating a lightweight, higher performance P-51 through a number of features - slightly thinner alloys (the original P-51 was in fact originally designed to stress specifications well over what the USAAF deemed really necessary), engine design (comparatively) advanced beyond the Merlin-derived engine in the current Mustangs, and a subtly redesigned fuselage that nonetheless was so structurally different the USAAF seriously considered giving it a new designation (the original YP-51F was noticeably smaller than the P-51D when placed side-by-side, almost like one of those newer kitplane replicas). The YP-51F received additional refinement (I think mostly just a new propeller) and became the P-51H you see that Nighthunter provided.
Largely because of those alloy changes that I mentioned, the P-51H was deemed too fragile for the type of ground-attack work most prop fighters were doing in Korea, hence why they went back to the P-51D (if you're wondering why they didn't use P-47s in Korea, it's because the USAF determined that too many had already been scrapped to support war attrition rates - and most of the ones still flying at the time were P-47Ns which received a similar alloy switch-over to the P-51H and due to their high-altitude performance were deemed more critical for homeland defense/bomber interception).
Also, I'm not going to cry or complain too much if someone points out that any of this is wrong.
EDIT: or you can read for yourself: http://www.airvectors.net/avp51_2.html#m5