Is there a ranking of mathematics positions at a given university? What is the difference between, say, a postdoc and a lecturer? A senior lecturer and an associate professor? 

More generally, is there a ranking of mathematics positions at a given university?
An assistant professor (in the US, anyway) has a continuing position subject to achieving tenure. An Associate Professor has achieved tenure and has a long term commitment from the university. Postdocs normally have a term limited position that may be renewed a small number of times, if at all. A lecturer normally doesn't have a long term commitment. It is probably subject to annual renewal. A Senior lecturer is a bit more trusted and earns more, but is still just a lecturer. 

In some places the first couple of years of the undergraduate education are mostly taught by either lecturers or a special category of professors of the practice. The latter have regular appointments and are expected to know more about pedagogy and possibly less about technical research. Some quite fine institutions have such a system (Duke, CMU, Stanford, at least). This relieves the senior faculty from teaching low level (possibly large) courses and still gets a quality education for undergraduates. It is also a stable career path for those who would rather teach than do research, whereas "lecturer" can be quite risky. 

Note that in the US, there is no national system or nationally recognized definitions and rules. In other countries titles such as these may be regulated by law.