So.. you turned on the firewall on your remote Mac, and now you've locked yourself out of Screen Sharing? Good work. I've... err... never done that before.
You can turn off the firewall by setting the global state to 0:
sudo defaults write /Library/Preferences/com.apple.alf globalstate -int 0
Then just restart the firewall agent services:
sudo launchctl unload /System/Library/LaunchDaemons/com.apple.alf.agent.plist
sudo launchctl load /System/Library/LaunchDaemons/com.apple.alf.agent.plist
And presto! You're back into your Mac!