Gaziyev graduated from the Azerbaijan Architecture and Construction University and has a Candidate of Sciences degree in Physics and Mathematics. From 1968 to 1990, he worked as an associate professor of mathematics at the same institution. In 1988, he became one of the founders and first fifteen members of the sovereigntist Popular Front of Azerbaijan. He was known for his radical nationalist viewpoints and vehement support of Abulfaz Elchibey. Gaziyev was arrested in the summer of 1990 as an organiser of the anti-Soviet riots leading to the Black January massacre, and was incarcerated in the Lefortovo prison in Moscow. He was freed upon being elected to the Supreme Soviet of Azerbaijan later that summer, although his criminal case was never closed. With the escalation of the Armenian-Azerbaijani military conflict in Nagorno-Karabakh and Shusha becoming one of the few remaining Azerbaijani strongholds in the region, Gaziyev took command of the city's defence in January 1992.