The Merlin engine of a P-51D wasn't quite the same as the Merlin engine of a Spitfire Mk IX, which itself was a very different Merlin engine to that of a Spitfire Mk I. From the first production version, the Merlin I of 1936, Rolls-Royce continually modified and upgraded the engine, producing more than 50 different versions by the end of World War II. Merlins powered numerous British aircraft, and the design was licensed to Packard who produced their own version as the V-1650, used by the P-51 from the B variant onwards.
The inverted flight issue you refer to affected early Merlins that used float carburettors, most notably the Merlin II of the Spitfire Mk I and Hurricane Mk I. With a float carburettor negative g-forces starved the engine of fuel; this was most notable in a "bunt", a rapid diving manoeuvre that would cause a Merlin II to briefly cut out. A temporary solution was devised by Tilly Shilling of the Royal Aircraft Establishment: a restrictor known colloquially as "[Miss Shilling's orifice] (http://centralblue.williamsfoundation.org.au/miss-shillings-orifice-simple-solutions-to-technical-issues-can-make-all-the-difference-michael-spencer/)" that solved the issue with brief negative g-forces, though sustained negative-g (e.g. flying upside down) still caused an issue. Subsequent variants of the Merlin incorporated a restrictor and moved the location of the fuel outlet of the carburettor, and later variants used a Bendix-Stromberg injection carburettor as described in "Pressure Injection: A Description of the Stromberg System Widely Used on American Aircraft", Flight magazine, September 11th 1941.
The V-1650-3 of the P-51B/C and V-1650-7 of the P-51D were based on the Merlin 60 series of two-stage two-speed engines and used an injection carburettor ("Bendix-Stromberg PD-18A1 2-barrel injection type updraft carburetor with automatic mixture control and 4-position manual mixture control", to be precise, according to Aircraft Engines of the World), so Mustangs had no issues with negative g-force manoeuvres.