Two perspectives are there
I perspective - If you wish only heirarchy to be changed, you can put both the image fields one above other inside a flowable subform and make both hidden. Do make a small difference in height of two images so that when heirarchy is made automatic, it will read from top to bottom. Make sure that difference in height is very minor so that user doesn't make out that there is any difference in position of both the images.
II Perspective - A bit complex solution involving 3 buttons. You can control z order at runtime. Using this solution you can make an image appear or disappear on top of another image. In other words you can control z order.
Thanks,
Arjun