Jan van Oort's answer triggered me to buy Robert W. Smith's "The Space Telescope" that was referenced in his source. This book gives a bit more context.
According to Smith, the extra time was not just "testing and debugging". In particular, the thermal-vacuum tests performed on the fully assembled telescope conducted in May of 1986 revealed a number of issues. In particular, it was found that the spacecraft consumed 100 - 300 Watts more than was predicted, leading to the conclusion that after only a few years in orbit the power consumption would already exceed the production due to degradation of the batteries as they aged.
Other issues arose from the thermal-vacuum testing. None was major in itself, but when taken in combination with the power problem and the very immature state of the ground system, they, in the opinion of many participants, made in highly unlikely that the telescope could have come even close to meeting a launch date of late 1986.
(Smith, p. 370)
(The launch was first scheduled for August, 1986 and then rescheduled to October 27, 1986.)
So keeping the spacecraft in a clean room at Lockheed after the Challenger disaster, was not just storage: it was still being actively worked on. The power system issue had to be fixed and also the safing system was found to be unreliable and modified. In the end so many changes had been performed after the first thermal-vacuum test that at late as 1987 it was considered to do a second thermal-vacuum test. In 1988, they were still working on the ground support systems (Smith, p. 371).
Of course, after all issues had been resolved, presumably somewhere in late 1988, the spacecraft still had to remain in storage for another one or two years until its launch in 1990. It may have been powered on during that period also, but I couldn't find anything on that, nor could I find during that last period it still cost $6-7 million per month to keep it in storage and keep essential staff employed.