Although I have not flown for a few years, unless something has radically changed logging your hours in your log book has nothing to do with the legality of the aircraft. You would still log even if you had not done your job as a P1 correctly e.g. checking the aircraft documents etc.
I would go with Sam that if you steal an aircraft you can still put the hours in your log book as P1. Might not be the brightest thing in the world to do though!
I would pose another question that could you log a flight as P1 if your licence or your validation was expired by a few days?