How can I extract the Mountain Lion installer from the recovery partition I just got a new macbook pro, and I want to swap out the internal hard disk with an SSD. My machine did not come with install media, so I was planning on trying to make some based on the recovery partition.

I have already used sudo chflags nohidden BaseSystem.dmg to get to the BaseSystem.dmg file on the recovery partition, but it is only 456.6MB, far to small to contain the (4.3GB? 4.75GB) Mountain lion install disk image. Where is the disk image hidden?

(I have blank DVDs of both sizes, but no erasable USB sticks.)
You don't need to worry about having to copy any data, making USB sticks or having the media present. Use Mountain Lion's Internet Recovery procedure, all files is downloaded and installed on the new drive without having any files.
You replace the HDD and start with Command-R...
See OS X Internet Recovery for more info about the procedure, quote:

If you happen to encounter a situation in which you cannot start from the Recovery System, such as your hard drive stopped responding or you installed a new hard drive without OS X installed, new Mac models introduced after public availability of OS X Lion or OS X Mountain Lion, automatically use the OS X Internet Recovery feature if the Recovery System (Command-R method above) doesn't work. OS X Internet Recovery lets you start your Mac directly from Apple's Servers. The system runs a quick test of your memory and hard drive to ensure there are no hardware issues.
OS X Internet Recovery presents a limited interface at first, with only the ability to select your preferred Wi-Fi network and, if needed, enter the WPA passphrase. Next, OS X Internet Recovery will download and start from a Recovery System image. From there, you are offered all the same utilities and functions described above.

Regarding &quot;Where is the [OS X] disk image hidden?&quot;, the Recovery Partition is a minimal bootstrap that connects to a wi-fi network to download the complete OS X 10.8 install, that's why it is so small. See here for further info: About OS X Recovery.