First:
Your ad_filter_menu
is a filter function: it filters/manipulates $sorted_menu_objects
That’s why you always have to return the $sorted_menu_objects
, and return '';
won’t work.
Second:
A better way to achieve the desired behavior (adding thumbnails to navigation) is to extend the Walker_Nav_Menu
class
There are several guides and templates out there that fix this for you, see for example this previous question