It all depends on size. Stomatopods are common part of octopus diets, but large stomatopods also will feed on octopus. I've looked at this a bit in blue-rings and an H. lunulata will kill and partially eat a stomatopod roughly its own size, but there are species of stomatopod that will kill and eat blue-rings if they are about have the size of the stomatopod.
Many smashing gonodactylids when they see an octopus coming try to get into the open and attack aiming at the head. In one of Hall's films there is a great shot of a Hemisquilla attacking a large BiMac and in one of the Mimic films their is a sequence of a large lysiosquillid swimming up into the water column pursuing a mimic.
The bottom line is that if the octopus and stomatopod are vary different in size, the smaller one will probably become lunch. It they are close to the same size, it will depend on the species and other factors, but it is unlikely that they will coexist for very long.
Roy