I want this to remember the original position and automatically move the element back when it falls outside of the media query.
But I am having issues where the prev/next element that was originally references has also moved.
A general remark : you have to define clearly what "original position" is when the "original context" is no more.
I think one of your problem is you use moving elements as reference.
Maybe you can leave an empty (fixed) html tag before moving :
// create an empty tag, which will be left at the "original position"
var $beacon = $('<span class="beacon"></span>');
$(this).after($beacon);
// keep a reference to this node
$(this).data('unmatch-beacon', $beacon[0]);
// the unmatch function would be something like :
data.unmatch = function(){
var beacon = $(this).data('unmatch-beacon');
$(beacon).after(this);
$(beacon).remove();
$(this).data('unmatch-beacon', null);
};