Well you could try to change the php for loop to be
<?php $i=0; foreach(array_reverse($this->getGalleryImages()) as $_image): ?>
or
<?php $i=0; foreach(array_reverse($this->getGalleryImages()->getData()) as $_image): ?>
if getGalleryImages() returns a collection
but that would be kind of a hack. That may meet your immediate needs however. In general, you should post the code for getGalleryImages() so we can see if the problem lies there or in possibly in your DB.