HOWTO customize application pages in the layouts folder in WSS 3.0 and MOSS 2007
I often get a number of questions from developers who want to know how to apply their own customizations to the application pages that ship as a part of Windows SharePoint Services 3.0 and Office SharePoint Server 2007. Well, apparently, I'm not alone as we've just recently released a KB article that describes the process and addresses many frequently asked questions on how to perform these customizations in a manner that is supported by Microsoft.
Excerpt taken from the article:
Modifying the files that are installed by SharePoint is not supported. However, there are some scenarios in which you may have to modify these files to achieve consistent branding or other customizations. When you modify these files, you must consider that they may be replaced by future updates and service packs. Additionally, there may be complications when you upgrade to later versions of the product. Keep backup copies of all customized files in case they are overwritten by an update. Product support will provide commercially reasonable support for help with modifications but will be unable to provide product changes or hotfixes that result from modifying the files that are installed by SharePoint.
More details can be found at http://support.microsoft.com/kb/944105/en-us.