Given their common interests against Russia, wouldn't an Ottoman-Japanese alliance make sense? Furthermore, the Ottomans have had interests in Aceh and in the Indian Ocean historically, and their territorial ambitions wouldn't conflict with those of the Japanese for the time being.
It would run in the same issue as a Hapsburg-Safavid Alliance to use as a example: the distance between them would make cooperation immensely difficult not to mention the distance kneecaping the possibility of sending support in the form of materials and money any meaningful window of time.
You could make a argument given the Franco-Japanese Alliance during the war but in that case the French already had committed outposts to draw troops from, kept sending reinforcements and the alliance was more of a war convenience that only lasted during the war period instead of being a permanent thing.
I think it's possible especially when the ottomans are crumbling and the safavids are becoming weaker. Like in the 19th century when Russia expanded everywhere.
Russia can also leverage Christian sentiments against the 'muslim oppressors'.
Assuming the Ottomans will crumble in the first place, their decline wasn't inevitable and especially TTL with the recent reforms, they'll seemingly have a few more years to get their act together if they want to better resist the Christian powers.
If they want to leverage that sentiment, they're much more likely to do it in Bessarabia, the Crimean Khanate and Romania instead of the Caucasus as even before Peter's foray into Azerbaijan, the travelers he had sent there to survey the region complained about the "Armenian's weird Christian faith" and that the Georgians weren't dissatisfied with Muslim rule and wouldn't want to be "liberated", so already whatever chance the Russians may have in advancing into the region drops to zero without the rumors of gold.