each armor item has a certain base defense range, for example a Grim Helm can roll any defense number in the range 60-125. if you upgrade it into a Bone Visage, this base defense is rerolled, range for Bone Visage is 100-157. So if you are unlucky, you may find a rare Grim Helm with 120 defense, upgrade it and end up with Bone Visage that only has 110 defense.
to make this worse: items with +X% ed mod always spawn with a base defense of (max base defense +1), but this base defense is rerolled randomly after upgrading. so assume a grim helm with +100% ed: base defense is 125+1=126, total defense 252. upgrading can lead to Bone Visages with base def 100-157 (which means total def 200-304).
long story short: if the base defense ranges overlap for non-upped and upped item, there is a possibility that you lose defense by upgrading