What does the '头' in '头一次遇到' mean? I know the literal meaning of 头, but I'm confused about what it mean and what it's function is when it is placed in this structure.

头一次遇到 I wrote is not a complete sentence, but 一次遇到 here means the first time (I) met....
头 not only means 'head'.It also means 'the first order',also means 'leader' , 'the first class','the beginning'etc. Because(actually my guess) in Chinese culture, head is the first and important part of the human body.

You can also say"头三个人"，which means, the first three people. 
Another example is '头排'，which means 'the first row'. Here '一' is missing because generally '头'and '一' refers to the same meaning.
You can replace '头'by'第'sometimes. e.p. you can say either '头一次遇到' or '第一次遇到'. 
BUT! '头三个人' and '第三个人' have different meanings. '第三个人' means the third person.