{% if profile.user.profile_pic %}
{% thumbnail item.image "50x50" crop="center" as im %}
<img src="{{ profile.profile_pic.url }}"
width="{{ im.width }}" height="{{ im.height }}">
{% endthumbnail %}
{% endif %}
Looks like you have a lot of mistakes in the variables you are referencing above. Your first {% if %} tag refers to profile.user.profile_pic, though I'm almost certain you want to reference profile.profile_pic.
Also, your thumbnail tag should look like this:
{% thumbnail profile.profile_pic "50x50" crop="center" as im %}
Finally, since you are assigning the thumbnail to the im var, you'd want the image src to point to {{ im.url }}, not {{ profile.profile_pic_url }}.