The 24th seed exploded with rage over a line call in the 79-minute first set on court eight, hitting the umpire's chair with his racket and throwing his water bottle across court.
His outburst was sparked by a line call which the Pole furiously contested and at one stage he collapsed to his knees in frustration with his forehead touching the playing surface.
His Indian opponent took the tiebreak 12-10 to win the set and, at the changeover, Janowicz again argued his case with Croatian umpire Marija Cicak before making the point more forcefully with his racket.
Janowicz was back on his knees 161 minutes later in celebration after a remarkable comeback that secured him a third round tie against Spanish 10th seed Nicolas Almagro.
India's sole remaining representative in the single's draws, Devvarman raced away with the second set while the Pole was still regaining his composure.
Despite tallying 88 unforced errors over the match, Janowicz struck back by ramping up his serve and unleashing his forehand to level up the match at two sets all.