Paul, I don't see where this should be having the problem you are describing; if the code is correct, then at low or no RPM and throttle at 1, then when the current rises, the code should be cutting PWM to keep the equation balanced, but if PWM goes to 1 and current is still too high to keep the equation balanced, the problem is not the equation but rather just not having enough steps to bring PWM small enough.
If you can not increase the number of steps, then a possible workaround would be scale PWM exponentially to the 512 steps the code is able to use, or at least for the first 170 steps and then linear for the last 342 steps. (that would be to keep the high end of the scale from getting to jumpy, yet enable precision where it is needed at the low end.
Edit; thinking about this further, I think the formula for a hyperbola would be ideal to set your 512 scale to for all 512 steps.
Hyperbola - Wikipedia, the free encyclopedia
graph upper right, green, minus the offset from 0.