Is it possible to change the visibility of a file with AppleScript?

Yes.

Under OS X, you can use the command-line utility SetFile, installed with the Developer Tools. Eg:

do shell script "/Developer/Tools/SetFile -a V /path/to/file.txt"

Simply changing “-a V” to “-a v” will make the file visible again.

Under OS 9 and back it is possible to change a file’s visibility with AppleScript but a third party scripting addition (osax) will be needed. The Akua Sweets and File Visibility scripting additions both offer this capability.

To search, browse and download a wide variety of scripting additions which are available.

Example Script:
Using Akua Sweets, this script will toggle visibility of a file “theFile” from on to off or off to on:

set extInfo to extended info for theFile
set invisStatus to invisible status of extInfo -- i.e. true or false 
set invisible status of extInfo to (not invisStatus) -- opposite 
apply catalog info extInfo to theFile