Some railroads kept the number with the frame. If multiple locomotives were in for major work that required separation of the boiler from the frame, they might be reassembled with the first available frame with the first available boiler. And for whatever reason the completed locomotive left the shop with the number associated with the frame. This seems to have happened a number of times with the SP's standard gauge fleet. Also the British seemed to keep the numbers with the frame.
An example of the D&RG keeping the number with the frame probably comes from when the Class 60 (C-16) locomotives received rebuilt or replacement boilers. Number 283 was sold in July 1933 to the Nevada County Narrow Gauge RR operating between Colfax and Nevada City in California. This locomotive was constructed as BLW cn 6057 in 2/1882. However, when on the NCNG it had the boiler with BLW plate cn #4983 which is the construction number for D&RG Class 60 locomotive number #42.
I understand that the reboilering of the Class 60 locomotives involved replacing the old iron boilers with new steel boilers. Some of these boilers were made by the D&RG, some were replacements bought from Baldwin and some from another outside supplier.
BN.