Changing first matrix block
Your condition {% if entry.contentMatrix.first %} will check if there exists a block in your field or not, it does not check if your current block is the first or not. Since there is one the condition will always become true. What you want to do is to check if you are in the first loop or not so I would suggest you to do something like this

{% for key, block in entry.contentMatrix %}
    {% if key == 0 %}


Or something like that