OK, I have found out that using iptables it is possible to forward ports, so on my laptop:
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A PREROUTING -s 192.168.40.0/24 -p tcp --dport 80 -j DNAT --to 192.168.38.2:8080
iptables -t nat -A POSTROUTING -s 192.168.40.0/24 -d 192.168.38.0/24 -j MASQUERADE
so everything that comes from the z and is destined for port 80 gets sent to port 8080 (the proxy server) on the window$ pc. Everything which comes from the z and is destined for the ethernet network is made to look like it comes from my laptop.
This seems to have worked for the package manager, but konqueror doesn't want to play the game, even if I tell it to use the proxy server (which should bypass the first rule, but not the second). It seems to be a dns problem- I have had problems with this before, but I haven't the faintest how to fix it. The other strange thing is that 'iptables -t nat -L -v' shows that the first rule isn't actually doing anything, 0 packets, 0 bytes have gone through it, even when the package manager has updated it's lists. If this is really true, how the heck is the package manager getting out to the net? It doesn't know about the proxy server, and it's even managing to resolve domain names, which konqueror can't even when using the proxy.
When using a proxy, where does a program resolve domain names?
EDIT: Ok, I'd forgotten I'd set the packagemanager up for the proxy, but with the disabled it can still get out to the net, with 0 packets showing up on the port redirect rule.