Will It be able to take off or not with a .40?
If you add enough tail weight. If you have enough ground clearance for the bigger prop needed for the larger engine. Then it will then fly like the model would with a .25 but with a heavier wing loading. Cubs are bad enough to take-off and land without flipping even when they're not nose heavy.
A Cub is not a design that lends itself to "ballistic performance" when overpowered. If it has a flat bottom airfoil you'll climb well but have to throttle way back for level flight, anyway.