Here's how I've managed this in the past w/Apache (with no apparent change to ranking):
1. Create a maintenance page with a defined open/close for the maintenance window - make the maintenance window about twice the amount of time you anticipate maintenance to last so you can roll-back if necessary
2. Rewrite rule to direct traffic to maintenance page:
RewriteEngine on
RewriteCond %{REMOTE_ADDR} !^1\.2\.3\.4
RewriteCond %{REQUEST_URI} !maintenance\.html$
RewriteRule .* /maintenance.html [L,R=307]
(Where 1\.2\.3\.4 is a regexp for your IP)
3. Complete maintenance and testing, comment out rewrite directives
The 307 Temporary redirect is, to the best of my knowledge, the proper response header for a maintenance situation, I've never seen any problems with maintenance lasting 1-3 hours on moderately busy sites (i.e. 100-500 users/hour).
Edit:
Per John Mueller's comments, you should also configure your webserver to throw a 503 error with a Retry-After timeframe to indicate that spiders should not cache the contents of the maintenance page.
To this end, you could follow AskApache's 503/Retry-After HowTo.
<meta name="robots" content="noindex" />tag on the maintenance page - will add that – danlefree Oct 28 '10 at 12:52