First, the play:
Ugh, this is so stupid, but here we go. The dunk is good, because the foul occurred at basically the same time. The foul is also an off-ball foul, not unlike the late charge after a player passes off. Except in this case, since Marreese Speights moved, it's a blocking foul. Thus, Martin's dunk was good and Bledsoe was put on the line.
Related: The late block/charge is ridiculous. That is all.