How can I search in CIviCRM for people who have got a "Full" membership less than 5 months after their "Student" membership expired?
How we did this in the end was to create some custom code that when a new membership was added it would check if there was a membership of the previous membership type. ie if they were purchasing a Full membership if they had a current or expired Student membership. 

If there was then it would calculate the number of days between the end date of the previous membership and the start date of the new membership and store this value in a custom field. We also added a feature that if the previous membership had not yet expired we would end it because in our case you were not allow to hold more than one membership at a time.

We can now run all the searches and views we like off this value.