This doesn't appear to be related to iRules. I would suggest you contact support for assistance with this issue.
https://websupport.f5.com/csp/welcome.asp
On a side note, yes, cookie persistence should work regardless of what port the nodes are configured on. I did a quick search for persistence + nodes defined on non-standard ports but didn't find anything. A good place to check for known/fixed issues is the latest version's release notes fixed and known issues sections:
Click here
You can check what the value of the persistence cookie should be using 'b makecookie NODE_IP:NODE_PORT':
[root@asm:Active] config b makecookie 1.2.3.4:80
Set-Cookie: BIGipServer[poolname]=67305985.20480.0000; path=/
or
Set-Cookie: BIGipServer[poolname]=67305985.20480.0000; expires=Sat, 01-Jan-2000 00:00:00 GMT; path=/
This output should match the Set-Cookie header in the HTTP response from BIG-IP to the client.
Here is the format of the cookie value (from the LTM config guide
Click here):
For example, the following string is a generated cookie template with the encoding automatically added, where [pool name] is the name of the pool that contains the server, 336260299 is the encoded server address, and 20480 is the encoded port:
Set-Cookie:BIGipServer[poolname]=336268299.20480.0000; expires=Sat, 01-Jan-2002 00:00:00 GMT; path=/
To create your cookie from this template, type the actual pool name and an expiration date and time.
Alternatively, you can perform the encoding using the following equation for address (a.b.c.d):
d*(256^3) + c*(256^2) + b*256 +a
The way to encode the port is to take the two bytes that store the port and reverse them. Thus, port 80 becomes 80 * 256 + 0 = 20480. Port 1433 (instead of 5 * 256 + 153) becomes 153 * 256 + 5 = 39173.
Hope this helps...
Aaron