Of course, this was silly - a better approach is to have the script ask me which state I want, and then change it if necessary (it still has to open the prefpane to check this, but at least you know what you're ending up with when you start).

Code:
(* script to switch on/off "Use all F1, F2, etc. keys as standard function keys" *)

set resultString to ""

set dialogString to "What do you want your function keys to be (without the Fn key)?"

display dialog dialogString buttons {"F1, F2...", "Media controls", "Cancel"} default button 3 with icon note

set choiceFlag to button returned of result
if choiceFlag = "Cancel" then return ""

tell application "System Preferences"
	activate
	set current pane to pane "com.apple.preference.keyboard"
end tell

tell application "System Events"
	if UI elements enabled then
		tell tab group 1 of window ¬
			"Keyboard" of process "System Preferences"
			if choiceFlag is "F1, F2..." then
				if value of checkbox 1 is 0 then click checkbox 1
				set resultString to "F1, F2, etc. set as function keys"
			else
				if value of checkbox 1 is 1 then click checkbox 1
				set resultString to "F1, F2 etc. set as media controllers"
			end if
		end tell
	else
		tell application "System Preferences"
			activate
			set current pane ¬
				to pane "com.apple.preference.universalaccess"
			display dialog ¬
				"UI element scripting is not enabled. Check \"Enable access for assistive devices\""
		end tell
	end if
end tell

delay 0.5

tell application "System Preferences"
	quit
end tell

if resultString is not "" then display dialog resultString buttons {"•"} with icon note giving up after 2
_________________________
If it's brokenless, don't suffix it...