Just braindamage on my part, you can actually access it directly ( ->instanceid ). I was fooled by the leading underscore in the documentation.
Blocks
Get course id from inside block object
This discussion has been locked so you can no longer reply to it.