Grant only came on the pitch in the 85th minute but his set-piece just four minutes later caught the wind to give the Cod Army all three points.
Eggert Jonsson had given the hosts the lead just after the hour mark when he headed home Tariq Fosu's cross.
Byron Webster scored from a Millwall corner in the final minute but the Lions drop down to 11th.
Fleetwood sub Bobby Grant scored directly from a corner to help his side beat Millwall in League One.