Ive done it both ways, and I have to say replacing the headunit first gave me the best sound. as long as your factory speakers are in good condition.
The stock speakers do well with the extra power. If the headunit also has highpass crossovers using it will allow you to clean up the lower frequencies that causes most of the poor sound (distortion).
I would say the factory headunits power output is more of a weak point then the speakers.
Unless you have the power available to run aftermarket speakers, I wouldn't bother with them imo.
A amplifier and aftermarket speakers would be the best sound for your buck but install is a bit more involved.
Toreador Red 05' FX4
4.0 4x4 A/Tran Ext.Cab Daily Driver. Nomads, BFG M/T's
Alpine 9857, JBL MS-8 DSP, US Acoustics 2x80w & 2x100w, Vifa 1" XT25 Dual Ring Radiator Tweeters 3k+ 24db slope, Dayton Audio 7" RS180-4 Mid-woofers 100Hz-3k 24db slope, 500w rms Kenwood Class-D Mono - JBL 10" GTO1014 Sealed. 100Hz- 12db slope