Lou Pearlman died from an ongoing cardiac problem ... TMZ has learned.
According to the Miami-Dade Medical Examiner's Office, the mastermind behind the Backstreet Boys and 'NSYNC ... died at a Miami hospital where he was scheduled to have heart surgery.
We're told 62-year-old Pearlman had been transferred from his prison cell to have the surgery, but as we reported ... he died Friday -- before the procedure. He had a history of cardiac issues.
The official cause of death is listed as natural causes.