I just bought a new Apple wireless keyboard, and got annoyed that F4 was hard-wired to the Dashboard, so here's what I did to change it. Warning! Driver hacking follows! Remember to back up the driver first, in order to avoid a possible major malfunction of the keyboard.
In Terminal, do:
Go to line 349, which is where the function key definitions reside. I haven't fully decoded the system yet, but I think that it works like this: Key,Function. For example:
sudo vi /System/Library/Extensions/AppleHIDKeyboard.kext
0x0007003a is the F1 key without the "fn" key pressed, and 0xff010021 is the code to decrease the screen's brightness. Based on that, here's my ugly hack. I changed 0x0007003d to 0x0007004d -- this apparently made the system think I pressed fn-F4 or something. Either way, it works, and it shows the desktop as I wanted it to.
Mac OS X Hints