Romelu Lukaku had given Inter a first-half lead with his 20th Serie A goal of the season before Bologna's Roberto Soriano received a red card for dissent after 57 minutes.
Martinez then squandered a golden opportunity to make it 2-0 five minutes later, striking his attempt from the spot straight at Lukasz Skorupski.
The visitors took full advantage of that reprieve, scoring through Musa Juwara and Musa Barrow inside the final 16 minutes to seal a memorable away win over the Nerazzurri, who had Alessandro Bastoni dismissed for two bookable offences.