Bill O'Reilly had what turned out to be an 11th hour meeting with Pope Francis -- but even shaking hands with His Holiness wasn't enough to spare his gig at FOX News. 

Bill was in St. Peter's Square Wednesday morning -- he'd been on vacation -- when he got an audience with the Pontiff. Just a quick meet and greet really ... handshake, exchange of salutations.

But put yourself in Bill's shoes at the time -- wouldn't ya have to ask for a prayer or two?

As we reported ... FOX News announced O'Reilly would not return to the network after about 70 advertisers pulled out amid allegations of sexual harassment against him.

Only so much a Pope can do.