Due to some emergencies cropping up from time to time, I have had to do something similar, and have had no problems so far. It is probably not best practice, but if you have to do it, then so be it.
I would suggest that it is best to mash, sparge, then get the wort up to the boil, and then...