Create referral url for user and add UID to hidden field when url used
If I understand the question correctly, you want something like:

h(tt)p://www.example.com/register?uid=25

where register is a webform that the incoming person can access?


I would start by creating the form at the correct location with all of the elements you want
use some javascript (or form override) to hide the relevant form item that will hold the uid
override the form submit function to assign the uid in the url to the hidden element


take a look at the documenation for webform, and the Drupal Form API for specifics.