Optimal timing to change my last name
Lots of people publish under things that aren't their legal name (nicknames, middle name, one last name instead of two), and I've never heard of it being a problem for anyone.  As for the timing, in all the cases I'm familiar with (and other fields may be different from math), there's a time after acceptance where you can make minor revisions and I think it shouldn't be a problem to modify the name you're using then.