I don't know if there's a way to do what you're asking, unfortunately.
One thing I often end up doing is running the same piece of code a couple times with different modifications each time. In that case, if you've already run the code once but would like to run the same thing again with a slight change, you can use the up arrow key in the console to select the previously-typed command--and then you can modify it in the console before hitting enter to run it.
I realize that doesn't fully answer your question, and maybe you already knew about this feature, but I use it all the time for a similar scenario to the one you're describing so I though I'd mention it.