Answer
No, Bernard Boursicot never discovered Shi Pei Pu's true gender before the story made headlines. He was under the impression that Shi Pei Pu was a woman for the entire time they knew each other. The story of their relationship and Boursicot's spying for China became public knowledge in 1983, and Boursicot was arrested and charged with espionage.