Try changing $username_cosmo and $password_cosmo back to $username_thilldesign and $password_thilldesign. Those are variables that hold the username and passwords and having different names will cause the connection to fail.
Keeping the localhost to 127.0.0.1 change, your connection should be:
$hostname_thilldesign = "127.0.0.1";
$database_thilldesign = "thilldesign";
$username_thilldesign = "cosmo";
$password_thilldesign = "cosmo";
$thilldesign = mysql_pconnect($hostname_thilldesign, $username_thilldesign, $password_thilldesign) or trigger_error(mysql_error(),E_USER_ERROR);
If that doesn't solve the issue, please try to remove the existing connection, and create a new one in its place.
If that doesn't solve the problem, please let me know.