Well, instead of setting it by cookie, I set it using JavaScript. I haven't tested this out except for Chrome, but it should get you started.
Assume your hidden field's ID is "latestReferrer".
<script>
$('#latestReferrer').val(document.referrer);
</script>
If you go to this testing page: http://go.servicetrade.com/Testing-Program_Testing-2-Column.html, you should see an alert that shows you that the Marketo community is your referrer. If you want to submit the form, I'll post back your Marketo record so you can see that it works.