The first step is for the PM to know who the Functional Managers are and treat them as Stakeholders for the Project. That means building a relationship with them and understanding their capabilities, priorities, issues and concerns. The relationship should be built before the inevitable project vs function conflict occurs. With relationship already in place, it will be much easier to confront and resolve conflicts.
With the relationship foundation established, the next step is to keep the Functional Mgrs informed of the status, needs and risks. At the same time, the PM can learn about pending changes, threats and even opportunities related to the resources controlled by the Functional Mgr
As crises develop, make sure the Functional Mgrs are informed and included as appropriate in the resolution.
Finally, the PM and Functional Mgr must make sure to communicate effectively with the Functional personnell that are assigned to the project team. Don't let them get caught in any kind of matrix organization cross-fire.