Completed your prison Max
Just as I was thinking I must not be as clever as I thought I was, and was going to give up in disgust, since I had no idea what to try next, I spied something, and found the cube I needed to get out.
I think I missed some of the level though, as I could see 2 things that appear to be part of the puzzle, but weren't used - so I think I found your surprise cube and cheated my way out.