“Ray of Frost” Spell + Water = Lock Broken?

I played only D&D 3.0 and 3.5 editions, but if similar, low-level spells exist in D&D 4.0 and Pathfidnder, please comment, I will probably make a transition to one of them anyway.

Is it possible to pour water into a lock, cast 0-level spell Ray of Frost, freeze the water and break the lock this way or is it sanctioned anywhere? I mean, that’s like 12 secs per lock at max (1 round for pouring, 1 round for casting), so if wizard is in a hurry it’s kinda cool way, although looks like a little power-gaming.

(Not to mention an easy way to escape from a locked cell. Even if dungeon is dry and a character is left for death there are always 0-level clerical spells like Create Water and such wizard-cleric duo is good to go.)

It’s more powerful than Open/Close spell since it won’t fail on locked doors. Sure, it won’t open door for us, but will break a lock — something Open/Close can’t do — and then we will open it manually like normal mortals do anyway.

Also, it deals d3 damage, but I don’t think we can use only this roll against lock DR, because frozen water is adding way more to this. There’s also a question, how much water can you freeze with d3 cold damage?

Damn, I love such low-level hacking 😉