Gary Alexander twice saw his spotkicks saved by Joe Lewis but each time assistant referee Steve Creighton ruled the England Under-21 keeper had come off his line.
Winger Martin made no mistake third time around before Jason Price's 58th minute effort sealed the win to take Lions to within three points of the Posh.
There was action at both ends early on with Lewis producing a smart stop from Alexander's freekick while Aaron Mclean headed George Boyd's cross just over the bar, but the game exploded into life after 21 minutes when Millwall were awarded a penalty for Chris Whelpdale's foul on Martin who, eventually, struck the ball into the top corner.
Martin turned provider in the second half, supplying a deep left-wing cross to the unmarked Price, who stroked the ball into the roof of the net.
Alexander then missed a glorious opportunity to make it three as he sent a free header straight at the unfortunate Lewis.