If you are going the citizenship route, you or your lawyer will need to obtain from SEF “Certidão de contagem de tempo” as proof that you achieved 5 years’ residency. This document covers the periods in which your card was invalid. Thus the time spent waiting for a renewed card can be counted towards citizenship when you get the appropriate letter from SEF - which takes about 1-1.5 months to be issued - (see a recent post: SEF documentation for residency extensions counting towards 5-year citizenship timeline - #8 by 2bcb21c800144f23f132).
So there is no need to go to Court - and you may be pleased about this because as the Portugal president (a law professor) has said, the legal system moves at a snail’s pace (or slower than SEF).
There is an advantage - in the sense that your Contagem de tempo (or the 5 years) may occur early in the period of your last card, thus allowing you some time to apply for citizenship within the duration of your last card.