Upgrading mid-cycle replaces your monthly allotment with the new plan’s. If that upgrade was then refunded, the reversal took back the whole new allotment — including the credits your earlier, unrefunded invoice had already paid for. You could end a refund holding nothing.
A refunded upgrade now restores the pool you held before it. The invoice you did not get back still buys what it always bought.
Ordinary monthly refunds are unchanged.