Just use the Accessory side of the ignition switch as power for a relay. Then hook that power as the control power for an automotive relay that is used as a switch for your headlights (use on the normally-open contacts). What you'll want to cut is the wire that outputs from the headlight switch (in the 'on' position), and use those as the other leads to the relay.
A suggested relay is from Radio Shack: Catalog# 275-226, 12 VDC/30 Ampere SPST Automotive Relay. $6.49
The wiring diagram will be on the back of the relay's packaging. But here are better instructions (to avoid re-inventing the wheel):
Relays, Single Pole Double Throw (SPDT), Automotive Relays
This would allow you to accomplish your goals of having the lights on only when the car is on.
Best of luck! Let us know how it goes...