Applying gradient texture to deformed volume based on Z coordinate
A guy from blender IRC support channel (#blender on freenode) found the answer, so, as follows!

There are TWO methods. First one is raytracing:

It's really slow, and OSL depending. And casuses crashes, apperently ;)

Second method, much faster (bueno!) uses height maps instead of gradient texture.




Also, @JA12 simplified it even more, look at the nodes:


You can study it with the attached .blend file.
It's amazingly simple.
.blend file my mirror: mirror