Yes, you can apply for permanent residency when you are out of status. There was a change in the rules in Feb. 2005 that allows this. However, you must get back into status at the earliest possible time. That would mean that when you receive AIP (approval in process), which would be 6-7 months after your application is received, you should apply for an open work permit. Actually, since you're out of status, you must send the open work permit in at the same time as your PR application and attach a note asking that they process the work permit when you are eligible for it. That would be your best plan. If you leave the country, you're not guaranteed re-entry. Then your only option is to apply out of Canada.
Here is a link to a column from an immigration lawyer on this issue. Hope it helps!
http://www.metronews.ca/column_immigration.asp?id=13980&cid=3251