Babur, the Mughal founder, swore fealty to Isma'il (the Safavid Shah) at some point. But it seems to have been an uneasy alliance against the Shaybanids (the Uzbek dynasty descending on Khorasan to pick apart what's left of the Timurids, i.e. Babur's worst nightmare) to my understanding. Babur was Sunni and Isma'il was a rather fanatical Shi'a, a religious leader on top of being a political one. So when Babur had the chance to cozy with the Ottomans instead, he took it, and the Ottomans seem to have sent him technological advisors and know-how as a token of goodwill. He mentions using the Wagenburg order of battle in Panipat, which was appropriated from the Hungarians by the Ottomans.