The accessory will be attached to the upgraded item, yes, except in a few cases, in which the upgraded item does not have the accessory slot needed to hold the accessory.
In your specific case, you can examine Sinister Skelly Suit and Dread Skelly Suit on the wiki, and see that they both have the same four accessory slots. So there is no danger of your losing your accessory. The same goes for the masks.