What's an estimate for the cost of the cockpit technology on a 747 or 777?
Upwards of 30%.

The avionics industry is now a major multi-billion dollar industry world-wide and the avionics equipment on a modern military or civil aircraft can account for around 30% of the total cost of the aircraft. This figure for the avionics content is more like 40% in the case of a maritime patrol/anti-submarine aircraft (or helicopter) and can be over 75% of the total cost in the case of an airborne early warning aircraft such as an AWACS.
— Introduction to Avionics Systems, 2002, p. 1

Boeing promises up-to-date prices (including profit) on their website. The cheapest 777 is listed at USD 283.4 million. For comparison, the engines on the 777 account for 20%.
Moving on to the military side to confirm that 30-40%—as of 2009 the [electronics of the] weapons systems of a single Boeing F/A-18E/F Super Hornet cost some USD 35 million, 44% of the flyaway cost (cost of the aircraft production). Source: navy.mil, PDF page 32.

While expensive, on the long run they're cheaper. Kind of like replacing a good digital watch, compared to repairing an expensive mechanical watch.

The airlines want the advanced technology, despite its higher initial price, because of the lower life-cycle and replacement costs it offers. The cost of maintaining conventional cockpits has soared. Dial-type gauges require watchmaker skills to repair, and skilled people are getting fewer. At the same time digital devices are getting cheaper.
— FLIGHT INTERNATIONAL, 26 April 1986