Would this (theoretically) allow people to deposit and withdraw USD to/from BitStamp via Dwolla? Or does BitStamp's ripple gateway only support BTC?
Yes, that is the idea here. If I set up the gateway, then you would send Dwolla USD to my Dwolla account, I would then send USD/PeterLambert to your ripple account. You could then exchange the USD/PeterLambert for USD/BitStamp (I would set up liquidity within Ripple to allow people to do that 1:1), You could also directly trade the USD/PeterLambert for BTC/BitStamp. You can currently withdraw either USD or BTC from Ripple to BitStamp.
Going the other way, anybody who trades to get USD/PeterLambert could send them to me and I would send a Dwolla transaction to their account (or to the account of whoever they want to pay using Dwolla).
This would also allow people to easily invest dollars into companies on BitFunder. The whole transaction [Dwolla -> GateWay -> Ripple -> WeExchange -> Bitfunder -> Company] can happen in a couple minutes.
I would clarify this with Dwolla though.
Yes, before anybody sets this up they would want to clear it with Dwolla.