AVR timer output when Data Direction Register set to input
The "I/O-Ports" section of each AVR datasheet gives a detailed treatment of what each "virtual" output affects. In the case of OCnx, PVOV is directly affected, and PVOV is defined as "Port Value Override Value - If PVOE is set, the port value is set to PVOV, regardless of the setting of the PORTxn Register bit.". PVOE is set to OCnx ENABLE, controlled by COMnx. Therefore the OCnx value is not written to PORTx, and will always be output on the pin with an appropriate value in DDRx regardless of the setting of PORTx.