In simple aircrew terms, you must apply for your CPL/IR within 36 months from the end of the month in which you gained a full pass in the ATPL exams.
Once you have the CPL, the exams remain valid for ATPL issue for a period of 7 years after the date of the most recent IR revalidation.
Don't try to be a clever clogs and hedge your chances! If you want the security of a CPL/IR, don't do it earlier than is reasonably sensible. You may be lucky and be able to claim exmption on the grounds of a recent military IR qualifiction, but Sod's Law says you'll be on a ground tour and might then have to do all the exams again if you go over the 7 year limit.
Regarding validity periods, licences and ratings are different. A JAR-FCL licence of whatever breed has to be re-issued every 5 years. Whereas the different Class, Type and IR have individual validity periods - as do other ratings.
For example, my ATPL is valid for 5 years, my UK IMC Rating is valid for 25 months from date of test, my FI Rating is valid for 3 years, my SEP Class Rating for 2 years and my Examiner authorisation for 3 years - but not the same 3 years as the FI Rating!
No real snag for people in the airlines, as their routine LPCs take care of both IR and Type Rating revalidation requirements. But licence re-issue is easily overlooked; in more enlightened days the CAA BCPL, CPL or ATPL was valid for 10, not 5 years - and the PPL was, of course, a lifetime licence.