Once you trimmed you really trimmed the comp. You will have to use the comp settings to extend it again. Seems to me you are fundamentally misunderstanding something here. It's not necessary to trim anything to e.g. just constrain the RAM preview to the work area...
Mylenium is right; you are misunderstanding how AE works on a fundamental level. When you trim your comp, you've cut it. There's no going back. If you are trying to just RAM preview a certain area, that's what the work area is for. When you hit that trim button, BAM! It's trimmed. You can go into your composition settings and make your comp longer again, but it's going to be a pain to set all your layer in-points the way you want them.
I'd suggest you take a step back and go through these resources: Getting started with After Effects . Getting a solid foundation in the basics will save you much frustration in the future.
If your original comp was 40 seconds and you set the work area from 10 seconds to 30 seconds and you trimmed your comp to work area your new comp starts as zero and ends at 20 seconds. The footage layers are all the same length but they are just outside the boundaries of the composition.
To get the comp back to it's original 40 seconds open the composition settings and change the length of the comp back to 40 seconds. Now the comp is long enough, but your layers have shifted because changing the duration of a composition just adds time to the end of a comp. To fix the problem you will have to select all layers and then drag them to the right until the in point of your layers that originally started at zero line up with the first frame of the composition. This is not difficult to do unless every layer in your composition originally had it's in point before the zero mark.
As Mylenium and Szalam said, you have a basic misunderstanding of the concept of a composition and the work area. I change the work area around to RAM preview different sections of the comp and I use the trim comp to work area to permanently change the length of the composition and change the in and out points for the rendered sequence. Most of the time, however, when I'm editing a section of my composition I usually set the Ram Preview to From Current Time. It's much faster to move the CTI to where I want to preview the animation and press Zero on the numeric keypad than to monkey around with the work area.
Eeek, thanks a lot guys, realised what I was doing after a few more sessions playing around.
Thanks for the help!