The secret to the Merlins making near 4K HP and living at all? Allison rods. And they still come apart like a dimestore watch.
If you've ever watch the races at Reno, about 20% of the planes blow engines before the weekend is over. The Merlins are the worst.
To have been designed in or around 1934, the Allison is quite modern. Pent roof combustion chamber, dual spark plugs in each cylinder, four valves in each cylinder, overhead cams, forged pistons, a dry sump oiling system, and a pretty decent rod:stroke ratio and bore:stroke ratio, given that it was a low RPM engine.
You simply can't increase the RPM of those old engines that much, because there's too much mass, both reciprocating and rotating. Much over 4000 RPM and you're just waiting for the insides to become outsides.
Basicly, what you can do to those old engines is increase the compression ratio (they were around 6:1 or 7:1) to around 8:1 or 9:1. You can replace the crank, rods, and pistons with somewhat lighter and stonger parts. While the Allison used forged pistons, crank, and rods, metalurgy has improved. But there is a limit to how light you can make pistons and cranks for bores and strokes in the 6" range. Rods are pretty much the same, since you need a long rod to make a 6" stroke work.
You can also move to modern camshaft designs. The Allison is very adaptable to this with the overhead cam setup. The use of new technology in valvesprings and the rest of the valvetrain can allow significant advances in valvetrain speed and durability. This means that you can make the valves move a lot faster and still stay together. The faster you accelerate the valves open and closed the more air and fuel you can move in and out.
You can improve the rings and general combustion sealing with modern techniques and components.
There's also modern ignition to make sure you burn all you put in it.
Finally, you can improve the intake and exhaust systems. An Allison was converted to normally aspirated, with individual runner direct port fuel injection, and tuned headers. It easily made 800 more HP than the best of the Allisons in the P-38, with no supercharger at all.
You can improve the oiling system somewhat, but they are already dry sump, so there isn't as much room as you'd think.
My best estimate is that an Allison could be reliably pushed to around 3500+ HP and survive in combat conditions. You might get 5000+ HP if you pushed it all out, but I'm not sure I'd want to fly it if you did that. Most of the crashes at Reno are due to engine failure. When they fail, they often ventilate the crankcase and the oil catches fire. Not good, not good at all.
Now the big problem is going to be harnessing the power. The power the F117 and F130 Allisons had could not be harnessed by those raggedy Curtiss Electric props. It will take an incredible prop to fully harness that knid of power efficiently. The Hamilton Standard High Activity paddle prop came close, and if they used the four blade it would have been even better. While they have plenty of power, the planes at Reno don't effectively use it all. The prop is the limiting factor now.