An incident similar to this happened to me in MAD about 5 years ago. Flying GVA-MAD-GRU. In MAD had to go through security and I noticed a few items had slipped out of my jacket inside pocket when I collected it. Didn't notice my UK passport was left in the tray though and only found it missing when I tried to pull it out of the pocket in GRU and it wasn't there. Fortunately I'm a dual national and I had a Swiss passport in another pocket and managed to do my South American trip with that.
Managed to collect my UK passport on the way back through MAD a week later. Thumbs up ^ to MAD and IB staff who deciphered my extremely broken Spanish to get me to the place where my passport had been deposited in the 2 hour connection time I had in MAD (it was at the airport police station).