If you cut the nails holding one of the corner studs to the bottom plate and the top plate with a Sawzall, you can use a flat bar (or a flat bar plus a wrecking bar) to pull the stud off the sheathing nails. Either re-use the stud, or buy a new stud, and install the stud with toenails as shown in the link I provided in Comment #51 (this link: Outside corner detail).
Where To Buy Foam Spray Insulation
Note: The practice of foam insulating the attic has raised eyebrows in the building industry because "standard" roofing techniques call for the attic to be ventilated; however, in a vented attic situation it will become approximately 130 degrees in the summer. There's no reason for an air-conditioning and vent-ductwork to have to work in that type of severe conditions. By applying Icynene right on the underside of the roof deck, the severe temperatures no longer exist in the attic. In short, the attic is now a "conditioned" space of the house that is just as comfortable as any other room in the home. This is called a "Compact Roof", which means you can frame right up against it. The one drawback of using expanded foam on the inside of the roof is that this will cause the temperature of the shingles to rise, but how much is not yet known. And how much damage a rise in temperatures could cause is debatable.
Roof Spray Foam Insulation