Hi James,
My understanding is that you can apply even within 30 days of expiry.
The instruction guide seems to contradict itself on this point.
http://www.cic.gc.ca/english/information/applications/guides/5551ETOC.asp
It says:
"If your current temporary resident status is still valid you can apply for an extension of your stay providing you apply at least 30 days before the expiry date of your current status."
But then it goes on to say:
"The Case Processing Centre receives large volumes of applications in the temporary resident categories each year. It is recommended that you apply at least 30 days before the expiry of your current document."
The operational manual OP 11 ( http://www.cic.gc.ca/english/resources/manuals/op/op11-eng.pdf ) says, in section 24:
"A temporary resident must apply to extend their period of authorized stay before it ends. If they
have done so, their period of authorized stay as a temporary resident is extended by law until a
decision is made [R183(5)]. Such a person is considered to have implied status as a temporary
resident during that period."
You may wish to read parts of that manual, particularly section 5.4 on "dual intent", to know what factors CIC will be looking at in deciding whether to grant an extension.
We haven't been through this process ourselves, but as you submit your application, there may be some confirmation of receipt page for the application. You'll want to print that so you have proof that you've applied.