Where on the logic board is the flash memory that comprises the OS on the iPhone 3GS?
All of your data is stored on the flash memory, which is one of the chips soldered on to the logic board. It's not really possible to swap the memory to a different board (perhaps if you had advanced electronics skills, but I wouldn't like the chances of success).

If there's a problem with your logic board, you can replace it with a new one, as detailed in that iFixit link. Assuming everything goes to plan, and you have no other issues with the phone, it will effectively be a new iPhone. If you have a backup of your old one, you should be able to restore your data during the set up process.