There's a huge learning curve to figure out even approximately what the issues are here.
There is most certainly a strong suspicion of politically-motivated targeting of suspects, with allegations that much stronger circumstantial evidence against a completely separate group of terrorists was ignored because it wasn't politically expedient to go after them.
Megrahi has strenuously protested his innocence from the start, and has never wavered in this. There were huge problems with the original trial, which can be appreciated by looking at the reports published by the official UN observer to the trial.
I don't think, however, that doubts over the conviction had anything to do with the compassionate release. That's normal practice in Scotland. If anything, it seems as if the compassionate release may have been used as a carrot to persuade Megrahi to drop his ongoing appeal before it got any more embarrassing for the authorities.