Djokić broke through after nearly two hours of a tense but goalless football, with Mirjalol Kasimov’s side missing several chances before finally booking their place in the main draw.
AGMK will join Saudi Arabia's Al Hilal SFC, Shabab Al Ahli of UAE and Tajikistan's FC Istiklol in Group A, which begins in Riyadh next Thursday while Al Gharafa’s participation comes to an abrupt end.
The Qatari side came into the match with the greater pedigree in the competition but in the middle of a poor run of domestic form, losing four league matches in a row since March 12, and they began the game in a manner which suggested this too might be a struggle.
In contrast, AGMK looked more mobile, confident and grew stronger as the first half went on, going close to taking the lead when Husniddin Gafurov’s fine long range effort produced an equally impressive low save from Al Gharafa goalkeeper Yousof Hassan after 19 minutes.
It wouldn’t be the only time Hassan was forced to intervene, nor the last example of Gafurov going close, with the Uzbekistan international missing narrowly to the right in the 35th minute, after Al Gharafa, not for the first time, ran into trouble trying to play out from the back.
For a time, the hosts were under serious pressure but they ended the half the stronger, missing an opportunity on the counterattack when Amro Surag failed to make the most of an excellent Sofiane Hanni pass, before Hanni tried a shot of his own moments later, with Valijon Rakhimov called upon to make a straight-forward but important save on the stroke of half-time.
Aleksandr Kasyan had the ball in the back of the net for AGMK six minutes into the second half, but the goal was chalked off when the Ukrainian striker was spotted marginally offside, and the chances kept coming with Hassan saving to deny Akramkon Komilov before Sardor Rakhmanov missed a free header from the subsequent corner kick just shy of the hour mark.
As in the first half, the visitors failed to capitalise and, similarly, the hosts failed to make them regret it, with the increasingly tired sides both creating their fair share of promising openings as the minutes ticked away, but both lacking the execution required to settle the tie in normal time.
With the stakes abundantly clear, AGMK once again began the first period of extra time on the front foot, and it took a crucial clearance from Al Gharafa’s veteran Mexican defender Hector Moreno to prevent substitute Mirjamol Kasimov from breaking the deadlock when Hassan was caught out of position in the 109th minute.
Al Gharafa were living a charmed life, but AGMK finally broke through in the very last minute of extra time, when Serbian midfielder Djokić kept his nerve to slam home the winner after a brief scramble.
Djokić seized on a loose ball after Kasimov’s in-swinging corner kick hit the upright directly from a corner kick, but showed great composure to pick out the roof of the net, and send his club into the group for the very first time.
A famous victory secured, AGMK will begin their group stage campaign against Al Hilal.