Well, octopi are pretty smart and ingenious for an invert. Plus, with the stealth option, anything can be ambushed as the shark probably had no idea what was coming til it was too late. Plus, shark can taste yummy... oh wrong thread.
If the Octopi was as large as the shark I would of suspected the Octopi. I remember reading about Whalers finding battle marks on Sperm Whales and their battle with Squids (makes you wonder how many squids might of won
). I had a friend who had a small one for his aquarium and the thing attacked anything it could get it's tentacles on (of course it over ate and crawled out of his tank, tastelessly I rubbed it in about how he was such a bad owner that his pet would kill itself off before he did ). I don't think it's a matter of intelligence but of pure instinct and the shark fitting a particular size profile and movement, as far the Octopi was concerned it was just another fish.
I think the video mentioned it was about 3 to 4' sharks which isn't terribly big. I'm sure the Octupus was simply adapting to its living arrangements.. And probably pretty smug about it too, thinking itself cool and all that
Now that the octopus can go back to its garden... in the shade