thanks for googling!
Unfortunately it didn't solve the problem. I already had tried the same thing with the icl_object_id() (by the way this method is marked as deprecated and will be removed from WPML 3.3).
But thank you anyway for the hint to move it to a filter function. This way I can use my custom hook as well.