The TRNC does not require that your student visa be current, as long as you leave within 60 days of its expiry. You should be within this time frame if you leave by the end of November, as TRNC student permits are issued for a year's time frame which begins and ends on the last day of September, e.g. 30 Sept 2017 - 30 Sept 2018.
According to the Turkey Ministry of Foreign Affairs, you do not need a visa for your connection in Turkey (flight from Ercan to Atatürk) as long as you stay in the transit area.
If you will not leave the transit lounge at the airport you are not required to have transit visa. Otherwise, you have to make visa application to the nearest Turkish Representation. Contact information of the said missions can be reached through www.mfa.gov.tr (Ministry/Turkish Representations).
However, should you not have everything you need for your onward flight (e.g., separate ticket, boarding pass, baggage is not checked through) and you need to leave the transit area, you would require a visa (since your student visa has expired). As you are en route to the US, for which you would need to have a visa, that US visa means that you can use the electronic visa site. It takes about 3 minutes via the online system.
Pakistan: Official passport holders are exempted from visa for their travels to Turkey up to 90 days. Ordinary passport holders are required to have visa to enter Turkey. Ordinary passport holders with a valid Schengen, USA, UK, Ireland visa or residence permit may get their one month single entry e-Visas via the website www.evisa.gov.tr.
As you don't mention your university, Cyprus International University immigration procedure is used as a reference.