*ahem*
The number of tries required to get the first success in a sequence of Bernoulli trials is modeled by the geometric distribution, and its expected value is one over the success probability (e.g., the expected number of tries for a 50% success probability is, unshockingly enough, 1/0.5 = 2).
For difficulty level 35 I get the following:
Success% Cost Success% Cost Success% Cost Success% Cost
--------------- --------------- --------------- ---------------
0.1 289,000 10 4,740 40 2,925 89.3 8,398
1 29,900 15 3,827 50 3,010
2 15,900 20 3,435 60 3,277 "Cost" is the
3 11,233 25 3,148 70 3,834 expected value
5 7,520 30 3,013 80 5,063 of XP spend reqd
Focusing on the interesting bit of cost range seems to hint at 39.0% precisely as the percentage value that minimizes the expected cost. Here's the obligatory misleading graph:

Dots are data. The line is Excel's "smoothed line" interpolation thereof. The big dot is the position of the approximated global minimum.
Unfortunately, I originally assumed things would scale between levels keeping this generic shape. Turns out that's not quite it. On difficulty level 7, for example, (Inhibitor the Second), the sweet spot is 61.1% (chart). At level 19 (key the fourth), instead, the best option would be 47.9% (chart).
As you can see, though, the curves are basically flat at around 50% chance. This means that, if you're not feeling like running the numbers, the default is a reasonable choice (even though not the optimum).
This is my analysis. You can probably do much better than this, for example considering cumulative distribution functions to give confidence intervals or whatnot other statistical goodies I can't think of right now. I'll be giving it a try (I actually already have done so, accidentally... gotta be careful when the game is alt-tabbed away.)